diff options
author | José Valim <jose.valim@gmail.com> | 2011-09-26 16:26:04 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-09-26 16:31:30 +0200 |
commit | 5c0e9333c0973123fb1ce2cde68a1c211d422f91 (patch) | |
tree | e216a90b1d4ee98a24451832c1e419d5069ffb36 /actionpack | |
parent | b8553274439d34568a4c16031ed86ac6d111681d (diff) | |
download | rails-5c0e9333c0973123fb1ce2cde68a1c211d422f91.tar.gz rails-5c0e9333c0973123fb1ce2cde68a1c211d422f91.tar.bz2 rails-5c0e9333c0973123fb1ce2cde68a1c211d422f91.zip |
Encapsulate assets initialization in its own rake task.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 7764bd401a..65f0ad4cc8 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -10,8 +10,7 @@ namespace :assets do else require "fileutils" Rake::Task["tmp:cache:clear"].invoke - Rails.application.initialize!(:assets) - Sprockets::Bootstrap.new(Rails.application).run + Rake::Task["assets:environment"].invoke unless Rails.application.config.assets.enabled raise "Cannot precompile assets if sprockets is disabled. Please set config.assets.enabled to true" @@ -40,9 +39,14 @@ namespace :assets do end desc "Remove compiled assets" - task :clean => [:environment, 'tmp:cache:clear'] do + task :clean => ['assets:environment', 'tmp:cache:clear'] do config = Rails.application.config public_asset_path = File.join(Rails.public_path, config.assets.prefix) rm_rf public_asset_path, :secure => true end + + task :environment do + Rails.application.initialize!(:assets) + Sprockets::Bootstrap.new(Rails.application).run + end end |