Sha256: e7f3dbfa07e12af0ab479e0e042060856736b2281c9284e519e2e0efe916361e
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
# Original source: https://coderwall.com/p/aridag # set the locations that we will look for changed assets to determine whether to precompile set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb) # clear the previous precompile task Rake::Task["deploy:assets:precompile"].clear_actions class PrecompileRequired < StandardError; end namespace :deploy do namespace :assets do desc "Precompile assets" task :precompile do on roles(fetch(:assets_roles)) do within release_path do with rails_env: fetch(:rails_env) do begin # find the most recent release latest_release = capture(:ls, '-xr', releases_path).split[1] # precompile if this is the first deploy raise PrecompileRequired unless latest_release latest_release_path = releases_path.join(latest_release) # precompile if the previous deploy failed to finish precompiling execute(:ls, latest_release_path.join('assets_manifest_backup')) rescue raise(PrecompileRequired) fetch(:assets_dependencies).each do |dep| # execute raises if there is a diff execute(:diff, '-Nqr', release_path.join(dep), latest_release_path.join(dep)) rescue raise(PrecompileRequired) end info("Skipping asset precompile, no asset diff found") # copy over all of the assets from the last release execute(:cp, '-r', latest_release_path.join('public', fetch(:assets_prefix)), release_path.join('public', fetch(:assets_prefix))) rescue PrecompileRequired execute(:rake, "assets:precompile") end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-faster-assets-1.0.1 | lib/capistrano/tasks/faster_assets.rake |