Sha256: aafa73773b81a041526ce76c0d448e65dd2bcc57f6b3aa4515c74dc2a7b950a2

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

require 'mina/bundler'
require 'mina/rails'

set :delayed_job, 'bin/delayed_job'
set :delayed_job_pid_dir, '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
    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
    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
    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
    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)}'"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mina-delayed_job-1.1.0 lib/mina/delayed_job/tasks.rb
mina-delayed_job-1.0.1 lib/mina/delayed_job/tasks.rb