Sha256: d2a31c7318dbdadd4cd8bbd3c07bf415099bb82bf7fbea1b9ff0ae3606fa8099

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 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

1 entries across 1 versions & 1 rubygems

Version Path
mina-delayed_job-1.0.0 lib/mina/delayed_job/tasks.rb