Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed install task to be pure ruby, allowing it to run on systems (…
…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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |