为什么capistrano multiconfig不起作用?

时间:2016-06-28 20:21:10

标签: ruby-on-rails ruby capistrano rvm-capistrano multi-configuration

我为我的应用程序设置了capistrano,但我安装了multiconfig gem,以便我可以使用capistrano部署到两个不同的服务器。正在运行

cap primary:production deploy

效果很好,但是当我运行rails s时,我收到此错误:

rails s 

/home/sofia/.rvm/gems/ruby-2.2.2@big/gems/capistrano-multiconfig-3.0.9/lib/capistrano/multiconfig.rb:3:in `<top (required)>': uninitialized constant Capistrano::DSL (NameError)
    from /home/sofia/.rvm/gems/ruby-2.2.2@big/gems/bundler-1.12.5/lib/bundler/runtime.rb:100:in `require'
    from /home/sofia/.rvm/gems/ruby-2.2.2@big/gems/bundler-1.12.5/lib/bundler/runtime.rb:100:in `rescue in block in require'
    ...

这是我的config/文件夹中的目录:

deploy
deploy/secondary
deploy/secondary/production.rb.example
deploy/secondary/production.rb
deploy/staging.rb
deploy/primary
deploy/primary/production.rb.example
deploy/primary/production.rb

这是我的capfile

# Load DSL and set up stages
# require 'capistrano/setup'# The README says to remove this line
                            # and leaving it on does not change anything anyway

require 'capistrano/multiconfig'


# Include default deployment tasks
require 'capistrano/deploy'

require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/passenger'
require "whenever/capistrano"


# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

这是我的Gemfile

source 'https://rubygems.org'

gem 'rest-client'

gem 'yui-compressor'
gem 'pg'
gem 'react-rails', '~> 1.5.0'

gem "paperclip", "~> 4.3"

gem 'aws-sdk-rails'

gem 'whenever', :require => false
gem 'tod'

...

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'capistrano'
  gem 'capistrano-bundler'
  gem 'capistrano-passenger', '>= 0.1.1'
  gem 'capistrano-rails'
  gem 'capistrano-rvm'
  # Allows us to specify a separate configuration for each application/service
  gem "capistrano-multiconfig"


  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'railroady'
  gem 'web-console', '~> 2.0'
  gem 'letter_opener'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

1 个答案:

答案 0 :(得分:0)

这是capistrano-multiconfig v3.0.9的一个错误,现已修复于v3.0.10