lib/caploy/recipes/deploy.rb in caploy-1.0.0 vs lib/caploy/recipes/deploy.rb in caploy-1.0.1
- old
+ new
@@ -71,20 +71,30 @@
# set :pty, true
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
+set :rake, "#{fetch(:rbenv_prefix)} bundle exec rake"
+
namespace :deploy do
task :restart do
invoke 'unicorn:restart'
end
desc 'build missing paperclip styles'
task :build_missing_paperclip_styles do # app
- run "cd #{current_path}; RAILS_ENV=#{rails_env} #{rake} paperclip:refresh:missing_styles"
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} #{fetch(:rake)} paperclip:refresh:missing_styles"
end
+ desc 'generate nondigest assets after default precompiling'
+ task :compile_nondigest_assets do
+ on roles(:app) do
+ execute "cd #{current_path}; RAILS_ENV=#{fetch(:rails_env)} #{fetch(:rake)} assets:precompile:nondigest"
+ end
+ end
+ after 'deploy:compile_assets', 'deploy:compile_nondigest_assets'
+
desc "checks whether the currently checkout out revision matches the
remote one we're trying to deploy from"
task :check_revision do
branch = fetch(:branch)
unless `git rev-parse HEAD` == `git rev-parse origin/#{branch}`
@@ -113,12 +123,12 @@
end
desc 'Run the full tests on the deployed app. To deploy without tests, try cap deploy:without_tests or cap -S run_tests=0 deploy'
task :run_tests do
unless fetch(:run_tests, '1') == '0'
- run "cd #{release_path} && rake db:test:prepare"
- run "cd #{release_path} && nice -n 10 rake RAILS_ENV=production test"
+ run "cd #{release_path} && #{fetch(:rake)} db:test:prepare"
+ run "cd #{release_path} && nice -n 10 #{fetch(:rake)} RAILS_ENV=production test"
end
end
desc 'deploy without running tests'
task :without_tests do
@@ -134,10 +144,10 @@
namespace :cache do
desc "Flush cache"
task :clear do
on roles(:app) do
- run "cd #{current_path} && #{rake} cache:clear RAILS_ENV=#{rails_env}"
+ run "cd #{current_path} && #{fetch(:rake)} cache:clear RAILS_ENV=#{rails_env}"
end
end
end
desc 'Show deployed revision'