3

In my project im using whenever + capistrano, so here is my Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'whenever/capistrano'

Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

Here is my deployr.rb file:

set :application, 'privet-mccafe'
set :repo_url, 'git@codebasehq.com:digitalizm/mccafe-vk-privet-app/application.git'
set :scm, :git
set :branch, 'master'
set :keep_releases, 5
set :ssh_options, { forward_agent: true }

set :bundle_roles, :all

set :linked_files, %w{config/database.yml config/initializers/secret_token.rb}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :mkdir, "-p #{release_path.join('tmp')}"
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end
end

and here is my schedule.rb file:

every 4.hours do
  rake "notifications:deliver"
end

anyway, with executing cap staging deploy, im geting error:

cap aborted!
undefined method `instance' for Capistrano::Configuration:Class
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/whenever-0.8.4/lib/whenever/capistrano/recipes.rb:3:in `<top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/whenever-0.8.4/lib/whenever/capistrano.rb:1:in `require'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/whenever-0.8.4/lib/whenever/capistrano.rb:1:in `<top (required)>'
/Users/xamenrax/code/application/Capfile:7:in `require'
/Users/xamenrax/code/application/Capfile:7:in `<top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/bin/cap:23:in `load'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/bin/cap:23:in `<main>'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/xamenrax/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
xamenrax
  • 1,724
  • 3
  • 27
  • 47
  • possible duplicate of [Undefined method \`instance' for Capistrano::Configuration:Class](http://stackoverflow.com/questions/19370386/undefined-method-instance-for-capistranoconfigurationclass) – phoet Dec 23 '13 at 14:29
  • I saw that question, no success anyway. – xamenrax Dec 23 '13 at 14:51
  • Try removing `require capistrano/bundler` from your Capfile. According to this -> https://github.com/bundler/bundler/issues/2674 – usha Dec 23 '13 at 16:58
  • @Vimsha, I dont require `capistrano/bundler` in `deploy.rb` file, it's already required in `Capfile`. This is what issue about. – xamenrax Dec 24 '13 at 08:37

1 Answers1

11

whenever ~> 0.9.0 solve this problem

whenever < 0.9 does not compatible with capistrano v3

ruohanc
  • 182
  • 1
  • 8