Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Updated deprecated :environmentoption #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/mina/delayed_job/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
require 'mina/rails'

set :delayed_job, 'bin/delayed_job'
set :delayed_job_pid_dir, 'pids'
set :delayed_job_pid_dir, 'shared/pids'
set :delayed_job_processes, 1
set :delayed_job_additional_params, ''
set :shared_dirs, fetch(:shared_dirs, []).push(fetch(:delayed_job_pid_dir))

namespace :delayed_job do
desc 'Stop delayed_job'
task stop: :environment do
task stop: :remote_environment do
comment 'Stop delayed_job'
in_path(fetch(:current_path)) do
command "RAILS_ENV='#{fetch(:rails_env)}' #{fetch(:delayed_job)} #{fetch(:delayed_job_additional_params)} stop --pid-dir='#{fetch(:shared_path)}/#{fetch(:delayed_job_pid_dir)}'"
end
end

desc 'Start delayed_job'
task start: :environment do
task start: :remote_environment do
comment 'Start delayed_job'
in_path(fetch(:current_path)) do
command "RAILS_ENV='#{fetch(:rails_env)}' #{fetch(:delayed_job)} #{fetch(:delayed_job_additional_params)} start -n #{fetch(:delayed_job_processes)} --pid-dir='#{fetch(:shared_path)}/#{fetch(:delayed_job_pid_dir)}'"
end
end

desc 'Restart delayed_job'
task restart: :environment do
task restart: :remote_environment do
comment 'Restart delayed_job'
in_path(fetch(:current_path)) do
command "RAILS_ENV='#{fetch(:rails_env)}' #{fetch(:delayed_job)} #{fetch(:delayed_job_additional_params)} restart -n #{fetch(:delayed_job_processes)} --pid-dir='#{fetch(:shared_path)}/#{fetch(:delayed_job_pid_dir)}'"
end
end

desc 'delayed_job status'
task status: :environment do
task status: :remote_environment do
comment 'Delayed job Status'
in_path(fetch(:current_path)) do
command "RAILS_ENV='#{fetch(:rails_env)}' #{fetch(:delayed_job)} #{fetch(:delayed_job_additional_params)} status --pid-dir='#{fetch(:shared_path)}/#{fetch(:delayed_job_pid_dir)}'"
Expand Down