Skip to content

Commit

Permalink
Changed install task to be pure ruby, allowing it to run on systems (…
Browse files Browse the repository at this point in the history
…Windows) without POSIX compliant shells
  • Loading branch information
Dylan Lacey committed Mar 13, 2012
1 parent 10a5908 commit e4ed1b3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/tasks/install.rake
@@ -1,11 +1,17 @@
# Needed for pre-3.1. # Needed for pre-3.1.

require "fileutils"
require "find"

namespace :bourbon do namespace :bourbon do
desc "Move files to the Rails assets directory." desc "Move files to the Rails assets directory."
task :install, [:sass_path] do |t, args| task :install, [:sass_path] do |t, args|
args.with_defaults :sass_path => 'public/stylesheets/sass' args.with_defaults :sass_path => 'public/stylesheets/sass'
source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
`mkdir -p #{Rails.root}/#{args.sass_path}/bourbon` FileUtils.mkdir_p "#{Rails.root}/#{args.sass_path}/bourbon"
`cp -a #{source_root}/app/assets/stylesheets/* #{Rails.root}/#{args.sass_path}/bourbon` FileUtils.cp_r "#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/bourbon", {:preserve => true}
`find #{Rails.root}/#{args.sass_path}/bourbon -name "*.css.scss" | while read i; do mv "$i" "${i%.css.scss}.scss"; done` 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 end

0 comments on commit e4ed1b3

Please sign in to comment.