2013-03-11 44 views
0

在我的生產服務器上,我不想包含gem rspec rails。但是,試圖啓動我的導軌的服務器時,我得到一個錯誤:在生產Rails應用程序中,即使指示bundler跳過開發組,也會收到Bundler :: GemNotFound錯誤

/home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rspec-rails-2.12.0 in any of the sources (Bundler::GemNotFound) 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/spec_set.rb:85:in `map!' 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/spec_set.rb:85:in `materialize' 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/definition.rb:114:in `specs' 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/definition.rb:159:in `specs_for' 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler/runtime.rb:13:in `setup' 
    from /home/deployer/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.2/lib/bundler.rb:127:in `setup' 
    from /var/www/myapp/releases/20130311164742/config/boot.rb:8:in `<top (required)>' 
    from /home/deployer/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /home/deployer/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from script/rails:5:in `<main>' 

我的Gemfile看起來像:

source 'http://rubygems.org' 
ruby "1.9.3" 

gem 'rails', '3.2.11' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
end 

gem 'haml', '3.1.7' 
gem 'devise', '2.2.0' 
gem 'koala', '1.6.0' 
gem "mongoid", "~> 3.0.0" 
gem "braintree", "~>2.22.0" 


group :development, :test do 
    gem 'rspec-rails', '2.12.0' 
end 

在我的配置/的boot.rb文件,我告訴打捆只尋找默認或相關環境包括寶石:

require 'rubygems' 

# Set up gems listed in the Gemfile. 
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 

if File.exists?(ENV['BUNDLE_GEMFILE']) 
    require 'bundler' 
    Bundler.setup(:default, ENV["RAILS_ENV"]) 
end 

我驗證過RAILS_ENV環境變量設置爲生產,通過運行:

$ echo $RAILS_ENV 

並獲得'生產'回來。

爲什麼它仍然在尋找那個寶石,即使我告訴它不設置它?

+0

「rails s」的命令行輸出是否表示開發或生產? – mlibby 2013-03-11 17:35:15

+0

它沒有說什麼。對你的問題,以boot.rb我補充說: 把ENV [「RAILS_ENV」] 和它打印生產 – 2013-03-11 17:48:47

回答

0

這是一個錯字嗎? echo $RAILS_ENV。你錯過了Rails中的's'。

+0

是的 - 這只是爲了我的測試。沒有解決實際問題 – 2013-03-11 17:19:57

+0

你確定嗎?如果您設置$ RAIL_ENV而不是$ RAILS_ENV,服務器將運行在默認環境下,即開發 – boulder 2013-03-11 17:48:28

+0

唯一的輸入錯誤是在echo $ RAIL_ENV中 - 當我放入到計算器中時,這只是一種類型。迴應該變量只會打印出來 - 如何影響應用程序? – 2013-03-11 17:50:23

相關問題