Sha256: 6965cf04ace86cbf26768ce8bd39a93eff538938e85d1281c78707865a361991

Contents?: true

Size: 1.03 KB

Versions: 41

Compression:

Stored size: 1.03 KB

Contents

module CapistranoDeployManagement
  module Whenever
    def self.load_into(configuration)
      configuration.load do

        set :whenever_cmd do
          if using_recipe?(:bundle)
            'bundle exec whenever'
          else
            'whenever'
          end
        end

        set :whenever_identifier do
          if using_recipe?(:multistage)
            "#{application}_#{current_stage}"
          else
            application
          end
        end

        namespace :whenever do
          desc 'Update crontab file'
          task :update_crontab, :roles => :db, :only => {:primary => true} do
            run "cd #{current_path} && #{whenever_cmd} --update-crontab #{whenever_identifier}"
          end

          desc 'Clear crontab file'
          task :clear_crontab, :roles => :db, :only => {:primary => true} do
            run "cd #{current_path} && #{whenever_cmd} --clear-crontab #{whenever_identifier}"
          end
        end

        after 'deploy:restart', 'whenever:update_crontab'

      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
capistrano-deploy-management-0.1.5 lib/capistrano-deploy-management/whenever.rb