Skip to content

Instantly share code, notes, and snippets.

@nirvdrum
Created March 31, 2015 16:48
Show Gist options
  • Save nirvdrum/f66d7bb78bc35463399a to your computer and use it in GitHub Desktop.
Save nirvdrum/f66d7bb78bc35463399a to your computer and use it in GitHub Desktop.
namespace :deploy do
desc "precompile and deploy the assets to the server"
task :precompile_assets, :roles => :app do
if ENV['SKIP_ASSETS']
run "cp -a #{previous_release}/public/assets #{release_path}/public"
else
run_locally "#{rake} RAILS_ENV=#{rails_env} RAILS_GROUPS=assets assets:precompile"
run "mkdir -p #{release_path}/public/assets"
transfer(:up, "public/assets", "#{release_path}/public/assets", chunk_size: 16_384) { print "." }
run_locally "rm -rf public/assets" # clean up to avoid conflicts with development-mode assets
end
end
end
if Rubber::Util.has_asset_pipeline?
# load asset pipeline tasks, and reorder them to run after
# rubber:config so that database.yml/etc has been generated
#load 'deploy/assets'
#callbacks[:after].delete_if {|c| c.source == "deploy:assets:precompile"}
#callbacks[:before].delete_if {|c| c.source == "deploy:assets:symlink"}
#before "deploy:assets:precompile", "deploy:assets:symlink"
#after "rubber:config", "deploy:assets:precompile"
after "rubber:config", "deploy:precompile_assets"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment