Rails bundle只安装生产 [英] Rails bundle install production only
问题描述
我对Rails / ruby / bundler还是很陌生,有点困惑。
I'm still new to rails/ruby/bundler and am a little confused.
在我们的 config / application.rb
文件中有以下捆绑程序段:
In our config/application.rb
file there's this bundler segment:
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
,在我们的 Gemfile
中,我们使用不同的组,例如
and in our Gemfile
we use different groups, e.g.
group :development, :test do
gem "rspec-rails", ">= 2.7.0", :group => [:development, :test]
gem 'shoulda-matchers'
gem 'watchr'
gem 'spork', '~> 1.0rc'
gem 'spectator'
gem 'debugger'
gem 'wirble'
end
但是当我运行 RAILS_ENV =生产捆绑安装
(或捆绑安装--deployment
),它仍然会安装来自开发/测试小组的gems ...
But when I run RAILS_ENV=production bundle install
(or bundle install --deployment
), it still installs gems from the development/test group...
为什么会发生这种情况,或者我该如何使其正常工作?
Why does this happens or how can I make this work properly?
推荐答案
看看-没有
选项:
捆绑安装-未经开发测试
默认情况下,Bundler安装所有gem和您的应用程序使用了所需的宝石。 Bundler本身对Rails和当前环境一无所知。
By default Bundler installs all gems and your application uses the gems that it needs. Bundler itself knows nothing about Rails and the current environment.
这篇关于Rails bundle只安装生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!