From e4ed1b3234c87110c05a2b94510f781d9d3b6ec9 Mon Sep 17 00:00:00 2001 From: Dylan Lacey Date: Tue, 13 Mar 2012 17:31:45 +1000 Subject: [PATCH] Changed install task to be pure ruby, allowing it to run on systems (Windows) without POSIX compliant shells --- lib/tasks/install.rake | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/tasks/install.rake b/lib/tasks/install.rake index b70bb4f75..6eb7ade0d 100644 --- a/lib/tasks/install.rake +++ b/lib/tasks/install.rake @@ -1,11 +1,17 @@ # Needed for pre-3.1. + +require "fileutils" +require "find" + namespace :bourbon do desc "Move files to the Rails assets directory." task :install, [:sass_path] do |t, args| args.with_defaults :sass_path => 'public/stylesheets/sass' source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) - `mkdir -p #{Rails.root}/#{args.sass_path}/bourbon` - `cp -a #{source_root}/app/assets/stylesheets/* #{Rails.root}/#{args.sass_path}/bourbon` - `find #{Rails.root}/#{args.sass_path}/bourbon -name "*.css.scss" | while read i; do mv "$i" "${i%.css.scss}.scss"; done` + FileUtils.mkdir_p "#{Rails.root}/#{args.sass_path}/bourbon" + FileUtils.cp_r "#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/bourbon", {:preserve => true} + Find.find("#{Rails.root}/#{args.sass_path}/bourbon") do |path| + FileUtils.mv(path path.gsub(".css.scss", "")<<".scss") if File.basename(path).end_with?(".css.scss") + end end -end +end \ No newline at end of file