Created
September 13, 2012 08:27
-
-
Save armstrjare/3712857 to your computer and use it in GitHub Desktop.
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
set :asset_precompile_locations, ["config/application.rb", "app/assets"] # We check the git log for these locations to determine if recompilation necessary | |
after "deploy:update_code" do | |
assets.precompile | |
end | |
namespace :assets do | |
task :recompile, :roles => :web do | |
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} GROUP=assets assets:precompile} | |
end | |
task :symlink do | |
run "ln -s #{shared_path}/assets #{latest_release}/public/assets" | |
end | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
needs_recompile = if current_revision | |
from = source.next_revision(current_revision) | |
capture("cd #{latest_release} && #{source.local.log(from)} #{asset_precompile_locations.join(' ')} | wc -l").to_i > 0 | |
end | |
# Symlink public/assets to the shared assets directory. | |
symlink | |
if needs_recompile | |
recompile | |
else | |
logger.info "Skipping asset pre-compilation because there were no asset changes" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment