Sha256: 6e903e00614b37aa069d2d0929a661d04fdddfb686bc013e842dba6729f10282

Contents?: true

Size: 1.46 KB

Versions: 22

Compression:

Stored size: 1.46 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_jobs_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
    
    desc "Stop the delayed_job process"
    task :stop, :roles => lambda { roles } do
      run "cd #{current_path};#{rails_env} script/delayed_job stop"
    end

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

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

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
delayed_job-2.0.8 lib/delayed/recipes.rb
delayed_job_csi-2.0.7 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.14 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.13 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.12 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.11 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.10 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.9 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.8 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.7 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.6 lib/delayed/recipes.rb
delayed-job-ajaycb-2.0.10 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.5 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.4 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.3 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.2 lib/delayed/recipes.rb
delayed_job_with_named_queues-2.0.7.1 lib/delayed/recipes.rb
yetanothernguyen-delayed_job-0.0.1 lib/delayed/recipes.rb
delayed_job-2.0.7 lib/delayed/recipes.rb
delayed_job-2.0.6 lib/delayed/recipes.rb