2011-03-21 19:05:56 -04:00
|
|
|
namespace :assets do
|
2011-04-18 05:18:37 -04:00
|
|
|
desc "Compile all the assets named in config.assets.precompile"
|
2011-06-21 10:18:50 -04:00
|
|
|
task :precompile do
|
|
|
|
if ENV["RAILS_GROUPS"].to_s.empty?
|
|
|
|
ENV["RAILS_GROUPS"] = "assets"
|
|
|
|
Kernel.exec $0, *ARGV
|
|
|
|
else
|
|
|
|
Rake::Task["environment"].invoke
|
|
|
|
Sprockets::Helpers::RailsHelper
|
2011-04-19 14:06:09 -04:00
|
|
|
|
2011-06-21 10:18:50 -04:00
|
|
|
assets = Rails.application.config.assets.precompile
|
|
|
|
Rails.application.assets.precompile(*assets)
|
|
|
|
end
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|
2011-05-27 03:29:54 -04:00
|
|
|
|
|
|
|
desc "Remove compiled assets"
|
2011-05-27 10:42:11 -04:00
|
|
|
task :clean => :environment do
|
2011-05-27 03:29:54 -04:00
|
|
|
assets = Rails.application.config.assets
|
|
|
|
public_asset_path = Rails.public_path + assets.prefix
|
2011-06-19 21:03:55 -04:00
|
|
|
file_list = FileList.new("#{public_asset_path}/**/*")
|
2011-06-07 15:58:40 -04:00
|
|
|
file_list.each do |file|
|
2011-06-21 12:35:48 -04:00
|
|
|
rm_rf file
|
|
|
|
rm_rf "#{file}.gz"
|
2011-06-07 15:58:40 -04:00
|
|
|
end
|
2011-05-27 03:29:54 -04:00
|
|
|
end
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|