lib/ms_deploy/recipes/deploy/assets.rb in ms_deploy-0.0.10 vs lib/ms_deploy/recipes/deploy/assets.rb in ms_deploy-0.0.11
- old
+ new
@@ -1,15 +1,15 @@
Capistrano::Configuration.instance.load do
-
+ # http://www.bencurtis.com/2011/12/skipping-asset-compilation-with-capistrano/
namespace :deploy do
namespace :assets do
- desc "Compile assets"
- task :compile, :roles => :web do
- run "cd #{release_path}; RAILS_ENV=#{rails_env} #{rake} assets:precompile"
+ task :precompile, :roles => :web, :except => { :no_release => true } do
+ from = source.next_revision(current_revision)
+ if capture("cd #{latest_release} && #{source.local.log(from)} lib/assets/ vendor/assets/ app/assets/ | wc -l").to_i > 0
+ run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
+ else
+ logger.info "Skipping asset pre-compilation because there were no asset changes"
+ end
end
-
- after 'deploy', 'deploy:assets:compile'
- after 'deploy:migrations', 'deploy:assets:compile'
-
end
end
end