lib/capistrano/tasks/monit.rake in capistrano-delayed_job-3.0.1 vs lib/capistrano/tasks/monit.rake in capistrano-delayed_job-3.0.2

- old
+ new

@@ -1,58 +1,57 @@ -require 'capistrano/dsl/base_paths' -require 'capistrano/dsl/runit_paths' require 'capistrano/helpers/base' require 'capistrano/helpers/monit' +require 'capistrano/dsl/base_paths' require 'capistrano/helpers/delayed_job/monit' -include Capistrano::DSL::BasePaths -include Capistrano::DSL::RunitPaths -include Capistrano::Helpers::Base -include Capistrano::Helpers::Monit -include Capistrano::Helpers::DelayedJob::Monit namespace :delayed_job do + include Capistrano::DSL::BasePaths + include Capistrano::Helpers::Base + include Capistrano::Helpers::Monit namespace :monit do desc 'MONIT: Setup Delayed Job service' task :setup do on roles(:app) do |host| (1..fetch(:delayed_job_workers)).each do |n| info "MONIT: Uploading configuration for Delayed Job worker #{n} for #{fetch(:application)} on #{host}" # Upload configuration - set :tmp_delayed_job_monit_service_name, delayed_job_monit_service_name(n) + set :tmp_delayed_job_monit_service_name, Capistrano::Helpers::DelayedJob::Monit.service_name(n) set :tmp_worker_number, n - set :tmp_delayed_job_pid_file, delayed_job_pid_file(n) - upload! template_to_s_io(fetch(:delayed_job_monit_config_template)), available_configuration_with_path(n) + set :tmp_delayed_job_pid_file, Capistrano::Helpers::DelayedJob::Monit.pid_file(n) + set :tmp_delayed_job_start_command, Capistrano::Helpers::DelayedJob::Monit.start_command(n) + set :tmp_delayed_job_stop_command, Capistrano::Helpers::DelayedJob::Monit.stop_command(n) + upload! template_to_s_io(fetch(:delayed_job_monit_config_template)), Capistrano::Helpers::DelayedJob::Monit.available_configuration_with_path(n) end end end desc 'MONIT: Enable services for Delayed Job' task :enable do on roles(:app) do |host| (1..fetch(:delayed_job_workers)).each do |n| info "MONIT: Enabling service for Delayed Job worker #{n} for #{fetch(:application)} on #{host}" - enable_monitor(available_configuration_file(n)) + enable_monitor(Capistrano::Helpers::DelayedJob::Monit.available_configuration_file(n)) end end end desc 'MONIT: Disable and Stop services for Delayed Job' task :disable do on roles(:app) do |host| (1..fetch(:delayed_job_workers)).each do |n| info "MONIT: Disabling service for Delayed Job worker #{n} for #{fetch(:application)} on #{host}" - disable_monitor(available_configuration_file(n)) + disable_monitor(Capistrano::Helpers::DelayedJob::Monit.available_configuration_file(n)) end end end %w(start stop restart monitor unmonitor).each do |cmd| desc "MONIT: #{cmd.capitalize} Delayed Job" task cmd.to_sym do on roles(:app) do |host| (1..fetch(:delayed_job_workers)).each do |n| info "MONIT: #{cmd} Delayed Job worker #{n} for #{fetch(:application)} on #{host}" - command_monit(cmd, available_configuration_file(n)) + command_monit(cmd, Capistrano::Helpers::DelayedJob::Monit.available_configuration_file(n)) end end end end