gpt4 book ai didi

ruby-on-rails - Ruby on Rails whenever + capistrano v3 集成

转载 作者:数据小太阳 更新时间:2023-10-29 07:43:16 24 4
gpt4 key购买 nike

在我的项目中,我使用 whenever + capistrano,所以这是我的 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 }

这是我的 deployr.rb 文件:

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

这是我的 schedule.rb 文件:

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

无论如何,执行cap staging deploy,我得到错误:

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)

最佳答案

每当 ~> 0.9.0 解决这个问题

每当 < 0.9 与 capistrano v3 不兼容时

关于ruby-on-rails - Ruby on Rails whenever + capistrano v3 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20744958/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com