Skip to content

Instantly share code, notes, and snippets.

View olegykz's full-sized avatar
💭
🇺🇦

Oleg Yakovenko olegykz

💭
🇺🇦
View GitHub Profile
@olegykz
olegykz / deploy.rb
Created November 15, 2012 15:34 — forked from stympy/deploy.rb
Skip asset pre-compilation when deploying if the assets didn't change
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
begin
from = source.next_revision(current_revision) # <-- Fail here at first-time deploy because of current/REVISION absence
rescue
err_no = true
end
if err_no || capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}