From 794f27850aec1f3e3118c19dfa61220fc7d93875 Mon Sep 17 00:00:00 2001 From: martent Date: Thu, 10 Jan 2019 12:10:52 +0100 Subject: [PATCH] Merged Cap changes from po_extra --- config/deploy.rb | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 8c4d2e1..b1f785a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -5,6 +5,10 @@ set :rbenv_type, :user set :rbenv_map_bins, %w{rake gem bundle ruby rails} +set :default_env, { path: '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' } +set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" +set :rbenv_ruby, File.read('.ruby-version').strip +set :rbenv_roles, :all set :application, 'meks' set :repo_url, "https://github.com/malmostad/#{fetch(:application)}.git" @@ -22,7 +26,6 @@ set :linked_files, %w{config/database.yml config/secrets.yml } set :linked_dirs, %w{log tmp/pids tmp/sockets reports} -set :default_env, { path: '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' } set :keep_releases, 5 namespace :unicorn do @@ -43,6 +46,24 @@ end end +namespace :delayed_job do + desc 'Restart delayed job daemon' + task :restart do + on roles(:app) do + execute "cd #{fetch(:deploy_to)}/current && RAILS_ENV=#{fetch(:rails_env)} $HOME/.rbenv/bin/rbenv exec bundle exec ./bin/delayed_job restart" + end + end +end + +namespace :cache do + desc 'Clear Rails cache with rake task' + task :clear do + on roles(:app) do + execute "cd #{fetch(:deploy_to)}/current && $HOME/.rbenv/bin/rbenv exec bundle exec rake cache:clear RAILS_ENV=#{fetch(:rails_env)}" + end + end +end + namespace :deploy do desc "Copy vendor statics" task :copy_vendor_statics do @@ -90,24 +111,6 @@ end end - namespace :delayed_job do - desc 'Restart delayed job daemon' - task :restart do - on roles(:app) do - run("cd #{fetch(deploy_to)}/current && bin/delayed_job restart RAILS_ENV=#{fetch(:rails_env)}") - end - end - end - - namespace :cache do - desc 'Clear Rails cache with rake task' - task :clear do - on roles(:app) do - run("cd #{fetch(deploy_to)}/current && bundle exec rake cache:clear RAILS_ENV=#{fetch(:rails_env)}") - end - end - end - before :starting, 'deploy:are_you_sure' before :starting, 'deploy:check_revision' before :compile_assets, 'deploy:copy_vendor_statics'