Sha256: 45b8b921ba38cdce2570395bb2513dc5aaaeb44b0eba755178151e41fbb687e4

Contents?: true

Size: 974 Bytes

Versions: 3

Compression:

Stored size: 974 Bytes

Contents

module CapistranoDeploy
  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 #{deploy_to} && #{whenever_cmd} --update-crontab #{whenever_identifier}"
          end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capistrano-deploy-0.3.2 lib/capistrano-deploy/whenever.rb
capistrano-deploy-0.3.1 lib/capistrano-deploy/whenever.rb
capistrano-deploy-0.3.0 lib/capistrano-deploy/whenever.rb