Manage example extensions better.

This commit is contained in:
Chris Eppstein 2010-04-13 06:58:53 -07:00
parent 73c355c594
commit 75c62aaf49
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,3 @@
require File.join(File.dirname(__FILE__), '..', 'downloader')
install_from_github('chriseppstein', 'compass-colors', 'compass-colors')

2
examples/css3/clean.rb Normal file
View File

@ -0,0 +1,2 @@
require 'fileutils'
FileUtils.rm_rf "#{File.dirname(__FILE__)}/extensions/compass-colors"

View File

@ -28,10 +28,10 @@ def install_from_github(user, project, ext_name, branch = "master", working_dire
download_link = "http://github.com/#{user}/#{project}/zipball/#{branch}" download_link = "http://github.com/#{user}/#{project}/zipball/#{branch}"
extdir = File.join(working_directory,'extensions') extdir = File.join(working_directory,'extensions')
if !File.exists?(extdir) if !File.exists?("#{extdir}/#{ext_name}")
begin begin
puts "Downloading the #{ext_name} plugin into #{extdir}." puts "Downloading the #{ext_name} plugin into #{extdir}."
FileUtils.mkdir(extdir) FileUtils.mkdir_p("#{extdir}/#{ext_name}")
zipfile = File.join(extdir, "#{ext_name}.zip") zipfile = File.join(extdir, "#{ext_name}.zip")
open(zipfile, "wb") do |tgz| open(zipfile, "wb") do |tgz|
tgz << fetch(download_link).body tgz << fetch(download_link).body