From 75c62aaf490809206cca94f727105476cb5fc627 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 13 Apr 2010 06:58:53 -0700 Subject: [PATCH] Manage example extensions better. --- examples/css3/bootstrap.rb | 3 +++ examples/css3/clean.rb | 2 ++ examples/downloader.rb | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 examples/css3/bootstrap.rb create mode 100644 examples/css3/clean.rb diff --git a/examples/css3/bootstrap.rb b/examples/css3/bootstrap.rb new file mode 100644 index 00000000..f16a99aa --- /dev/null +++ b/examples/css3/bootstrap.rb @@ -0,0 +1,3 @@ +require File.join(File.dirname(__FILE__), '..', 'downloader') + +install_from_github('chriseppstein', 'compass-colors', 'compass-colors') diff --git a/examples/css3/clean.rb b/examples/css3/clean.rb new file mode 100644 index 00000000..3fdd688a --- /dev/null +++ b/examples/css3/clean.rb @@ -0,0 +1,2 @@ +require 'fileutils' +FileUtils.rm_rf "#{File.dirname(__FILE__)}/extensions/compass-colors" diff --git a/examples/downloader.rb b/examples/downloader.rb index 1bc37f9f..c735b87f 100644 --- a/examples/downloader.rb +++ b/examples/downloader.rb @@ -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}" extdir = File.join(working_directory,'extensions') - if !File.exists?(extdir) + if !File.exists?("#{extdir}/#{ext_name}") begin puts "Downloading the #{ext_name} plugin into #{extdir}." - FileUtils.mkdir(extdir) + FileUtils.mkdir_p("#{extdir}/#{ext_name}") zipfile = File.join(extdir, "#{ext_name}.zip") open(zipfile, "wb") do |tgz| tgz << fetch(download_link).body