lib/capistrano/tasks/capistrano2.rb in capistrano-sidekiq-0.2.6 vs lib/capistrano/tasks/capistrano2.rb in capistrano-sidekiq-0.2.7
- old
+ new
@@ -15,22 +15,22 @@
_cset(:sidekiq_role) { :app }
_cset(:sidekiq_processes) { 1 }
if fetch(:sidekiq_default_hooks)
before 'deploy:update_code', 'sidekiq:quiet'
- after 'deploy:stop', 'sidekiq:stop'
+ after 'deploy:stop', 'sidekiq:stop'
after 'deploy:start', 'sidekiq:start'
before 'deploy:restart', 'sidekiq:restart'
end
namespace :sidekiq do
def for_each_process(&block)
fetch(:sidekiq_processes).times do |idx|
- pid_file = if idx.zero? && fetch(:sidekiq_processes) <= 1
- fetch(:sidekiq_pid)
+ if idx.zero? && fetch(:sidekiq_processes) <= 1
+ pid_file = fetch(:sidekiq_pid)
else
- fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
+ pid_file = fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
end
yield(pid_file, idx)
end
end
@@ -55,43 +55,43 @@
logger.info 'Since JRuby doesn\'t support Process.daemon, Sidekiq will not be running as a daemon.'
else
args.push '--daemon'
end
- run "cd #{current_path} ; #{fetch(:sidekiq_cmd)} #{args.compact.join(' ')} ", :pty => false
+ run "cd #{current_path} ; #{fetch(:sidekiq_cmd)} #{args.compact.join(' ')} ", pty: false
end
desc 'Quiet sidekiq (stop accepting new work)'
- task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
+ task :quiet, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
for_each_process do |pid_file, idx|
quiet_process(pid_file, idx)
end
end
desc 'Stop sidekiq'
- task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
+ task :stop, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
for_each_process do |pid_file, idx|
stop_process(pid_file, idx)
end
end
desc 'Start sidekiq'
- task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
+ task :start, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
for_each_process do |pid_file, idx|
start_process(pid_file, idx)
end
end
desc 'Rolling-restart sidekiq'
- task :rolling_restart, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
+ task :rolling_restart, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
for_each_process do |pid_file, idx|
stop_process(pid_file, idx)
start_process(pid_file, idx)
end
end
desc 'Restart sidekiq'
- task :restart, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
+ task :restart, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
stop
start
end
end