From db50263e18b3cba72d1f4d90a0683080d5a5611d Mon Sep 17 00:00:00 2001 From: Alexey Frank Date: Tue, 10 Dec 2013 23:36:02 +0400 Subject: [PATCH] add capistrano options puma_default_hooks with compatibility --- lib/puma/capistrano.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/puma/capistrano.rb b/lib/puma/capistrano.rb index 8e4cb003..11056335 100644 --- a/lib/puma/capistrano.rb +++ b/lib/puma/capistrano.rb @@ -1,13 +1,11 @@ Capistrano::Configuration.instance.load do - after 'deploy:stop', 'puma:stop' - after 'deploy:start', 'puma:start' - after 'deploy:restart', 'puma:restart' # Ensure the tmp/sockets directory is created by the deploy:setup task and # symlinked in by the deploy:update task. This is not handled by Capistrano # v2 but is fixed in v3. shared_children.push('tmp/sockets') + _cset(:puma_default_hooks) { true } _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" } _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" } _cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) } @@ -15,6 +13,12 @@ Capistrano::Configuration.instance.load do _cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" } _cset(:puma_role) { :app } + if fetch(:puma_default_hooks) + after 'deploy:stop', 'puma:stop' + after 'deploy:start', 'puma:start' + after 'deploy:restart', 'puma:restart' + end + namespace :puma do desc 'Start puma' task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do