Sha256: 34ba94320fa72d2dfddceb40a9912a2b77f228daaf09fcc44bf4e0a572b2ca9f

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'capistrano'
require 'kapify/base'

Capistrano::Configuration.instance.load do
  set_default(:resque_user, user)
  set_default(:resque_workers, 2)
  set_default(:resque_queue, "*")
  set_default(:resque_bundle, "/usr/local/rbenv/shims/bundle")
  set_default(:resque_task, "environment resque:work")

  namespace :kapify do
    namespace :resque do
      desc "Setup Resque initializer and app configuration"
      task :setup, roles: :resque_worker do
        run "mkdir -p #{shared_path}/config"
        kapify_template "resque", "resque_init.erb", "/tmp/resque_init"
        run "chmod +x /tmp/resque_init"
        run "#{sudo} mv /tmp/resque_init /etc/init.d/resque_#{application}"
        run "#{sudo} update-rc.d -f resque_#{application} defaults"
      end

      after "deploy:setup", "kapify:resque:setup"

      %w[start stop restart].each do |command|
        desc "#{command} resque"
        task command, roles: :resque_worker do
          run "service resque_#{application} #{command}"
        end

        after "deploy:#{command}", "kapify:resque:#{command}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kapify-0.0.2 lib/kapify/resque/configuration.rb
kapify-0.0.1 lib/kapify/resque/configuration.rb