Skip to content

Instantly share code, notes, and snippets.

@ilyakatz
Created December 12, 2012 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakatz/4269402 to your computer and use it in GitHub Desktop.
Save ilyakatz/4269402 to your computer and use it in GitHub Desktop.
Selective skip of asset compilation
#You'll need to add an eydeploy.rb with this file in either your root directory or in the config directory
module EY
module Serverside
class Task
def app_needs_assets_when_changed?
assets_modified = run "git diff --name-only #{last_revision} | grep '/assets/' | wc -l"
if assets_modified.output.to_i > 0
# Call the original method to preserve behaviour.
app_needs_assets_orig?
else
# Keep the existing assets always!
keep_existing_assets
# App doesn't need assets.
return false
end
end
alias_method :app_needs_assets_orig?, app_needs_assets?
alias_method :app_needs_assets?, :app_needs_assets_when_changed?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment