Sha256: ab2a5dc85aab940d6084de8eeef16669a4f77685e37c9686db8781a86b517af9

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 #{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 #{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.0.0.beta2 lib/mina/delayed_job/tasks.rb
mina-delayed_job-1.0.0.beta1 lib/mina/delayed_job/tasks.rb