Sha256: 3ac814b3820597e0fc1e61d2b09bd55dffecc28bb5dc6e37b54aee23761a583a

Contents?: true

Size: 1.57 KB

Versions: 19

Compression:

Stored size: 1.57 KB

Contents

# Capistrano Recipes for managing delayed_job
#
# Add these callbacks to have the delayed_job process restart when the server
# is restarted:
#
#   after "deploy:stop",    "delayed_job:stop"
#   after "deploy:start",   "delayed_job:start"
#   after "deploy:restart", "delayed_job:restart"
#
# If you want to use command line options, for example to start multiple workers,
# define a Capistrano variable delayed_job_args:
#
#   set :delayed_job_args, "-n 2"
#
# If you've got delayed_job workers running on a servers, you can also specify
# which servers have delayed_job running and should be restarted after deploy.
#
#   set :delayed_job_server_role, :worker
#

Capistrano::Configuration.instance.load do
  namespace :delayed_job do
    def rails_env
      fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
    end

    def args
      fetch(:delayed_job_args, '')
    end

    def roles
      fetch(:delayed_job_server_role, :app)
    end

    def delayed_job_command
      fetch(:delayed_job_command, 'script/delayed_job')
    end

    desc 'Stop the delayed_job process'
    task :stop, :roles => lambda { roles } do
      run "cd #{current_path} && #{rails_env} #{delayed_job_command} stop #{args}"
    end

    desc 'Start the delayed_job process'
    task :start, :roles => lambda { roles } do
      run "cd #{current_path} && #{rails_env} #{delayed_job_command} start #{args}"
    end

    desc 'Restart the delayed_job process'
    task :restart, :roles => lambda { roles } do
      run "cd #{current_path} && #{rails_env} #{delayed_job_command} restart #{args}"
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
delayed_job-4.1.13 lib/delayed/recipes.rb
delayed_job-4.1.12 lib/delayed/recipes.rb
delayed_job-4.1.12.rc1 lib/delayed/recipes.rb
delayed_job-4.1.11 lib/delayed/recipes.rb
delayed_job-4.1.10 lib/delayed/recipes.rb
delayed_job-4.1.9 lib/delayed/recipes.rb
delayed_job-4.1.8 lib/delayed/recipes.rb
delayed_job-4.1.8.beta1 lib/delayed/recipes.rb
delayed_job-4.1.7 lib/delayed/recipes.rb
delayed_job-4.1.7.beta1 lib/delayed/recipes.rb
delayed_job-4.1.6 lib/delayed/recipes.rb
delayed_job-4.1.6.beta1 lib/delayed/recipes.rb
delayed_job-4.1.5 lib/delayed/recipes.rb
delayed_job-4.1.4 lib/delayed/recipes.rb
delayed_job-4.1.3 lib/delayed/recipes.rb
delayed_job-4.1.2 lib/delayed/recipes.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.1.1/lib/delayed/recipes.rb
delayed_job-4.1.1 lib/delayed/recipes.rb
delayed_job-4.1.0 lib/delayed/recipes.rb