1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Merge pull request #428 from alexeyfrank/capistrano_default_hooks

add capistrano options puma_default_hooks with compatibility
This commit is contained in:
Evan Phoenix 2014-01-25 12:30:30 -08:00
commit 6f64bee090

View file

@ -1,13 +1,11 @@
Capistrano::Configuration.instance.load do 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 # 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 # symlinked in by the deploy:update task. This is not handled by Capistrano
# v2 but is fixed in v3. # v2 but is fixed in v3.
shared_children.push('tmp/sockets') shared_children.push('tmp/sockets')
_cset(:puma_default_hooks) { true }
_cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" } _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
_cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" } _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
_cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) } _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_socket) { "unix://#{shared_path}/sockets/puma.sock" }
_cset(:puma_role) { :app } _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 namespace :puma do
desc 'Start puma' desc 'Start puma'
task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do