From 59c74604569758ec103aa3e417bd65eae8a357af Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 24 Aug 2015 14:11:34 -0700 Subject: [PATCH] fix cap tasks --- Capfile | 9 +-------- .../tasks/{delayed_job.rake => delayed_job.cap} | 7 ++++++- lib/capistrano/tasks/{nginx.rake => nginx.cap} | 0 lib/capistrano/tasks/{symlink.rake => symlink.cap} | 5 ++++- lib/capistrano/tasks/{web.rake => web.cap} | 5 ++++- 5 files changed, 15 insertions(+), 11 deletions(-) rename lib/capistrano/tasks/{delayed_job.rake => delayed_job.cap} (84%) rename lib/capistrano/tasks/{nginx.rake => nginx.cap} (100%) rename lib/capistrano/tasks/{symlink.rake => symlink.cap} (91%) rename lib/capistrano/tasks/{web.rake => web.cap} (89%) diff --git a/Capfile b/Capfile index d46de2179..c2c5f1a21 100644 --- a/Capfile +++ b/Capfile @@ -11,13 +11,6 @@ require 'whenever/capistrano' require 'capistrano3/unicorn' # Load custom tasks from `lib/capistrano/tasks` if you have any defined -Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } +Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } -after "delayed_job:stop", "delayed_job:kill" -after "deploy:symlink:shared", "symlink:local_files" -after "deploy:symlink:shared", "symlink:directories" -before "deploy:started", "web:disable" -before "deploy:started", "delayed_job:stop" -after "deploy:published", "delayed_job:start" after "deploy:published", "unicorn:reload" -after "deploy:published", "web:enable" diff --git a/lib/capistrano/tasks/delayed_job.rake b/lib/capistrano/tasks/delayed_job.cap similarity index 84% rename from lib/capistrano/tasks/delayed_job.rake rename to lib/capistrano/tasks/delayed_job.cap index 26f4e3ca8..6d8bb89d7 100644 --- a/lib/capistrano/tasks/delayed_job.rake +++ b/lib/capistrano/tasks/delayed_job.cap @@ -26,6 +26,7 @@ namespace :delayed_job do end end + desc "Kill delayed_job process" task :kill do on roles(:app) do procs = capture("ps -A -o pid,command").split(/\r\n|\r|\n/).grep(/delayed_job/).map(&:to_i) @@ -35,4 +36,8 @@ namespace :delayed_job do end end end -end \ No newline at end of file +end + +after "delayed_job:stop", "delayed_job:kill" +before "deploy:started", "delayed_job:stop" +after "deploy:published", "delayed_job:start" diff --git a/lib/capistrano/tasks/nginx.rake b/lib/capistrano/tasks/nginx.cap similarity index 100% rename from lib/capistrano/tasks/nginx.rake rename to lib/capistrano/tasks/nginx.cap diff --git a/lib/capistrano/tasks/symlink.rake b/lib/capistrano/tasks/symlink.cap similarity index 91% rename from lib/capistrano/tasks/symlink.rake rename to lib/capistrano/tasks/symlink.cap index 365ac92d0..0bca02399 100644 --- a/lib/capistrano/tasks/symlink.rake +++ b/lib/capistrano/tasks/symlink.cap @@ -22,4 +22,7 @@ namespace :symlink do execute :ln, "-s", "#{deploy_to}/shared/system/cache/tags.json.gz", "#{release_path}/public/cache/tags.json.gz" end end -end \ No newline at end of file +end + +after "deploy:symlink:shared", "symlink:local_files" +after "deploy:symlink:shared", "symlink:directories" diff --git a/lib/capistrano/tasks/web.rake b/lib/capistrano/tasks/web.cap similarity index 89% rename from lib/capistrano/tasks/web.rake rename to lib/capistrano/tasks/web.cap index 207ae2d8f..b39eb24e8 100644 --- a/lib/capistrano/tasks/web.rake +++ b/lib/capistrano/tasks/web.cap @@ -18,4 +18,7 @@ namespace :web do end end end -end \ No newline at end of file +end + +before "deploy:started", "web:disable" +after "deploy:published", "web:enable"