Rails installation kit only

Sorry if this is a question like RTFM, but I'm still new to rails / ruby ​​/ bundler and a bit confused.

Our config/application.rb file has this bundle 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 

and in our Gemfile we use different groups, for example.

 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 

But when I run RAILS_ENV=production bundle install (or bundle install --deployment ), it still installs gems from the development / testing team ...

Why is this happening or how can I do this job properly?

+62
ruby-on-rails-3 bundler
Jun 06 2018-12-06T00:
source share
2 answers

Take a look at the --without option:

bundle install --without development test

By default, the Bundler installs all the gems, and your application uses the gems it needs. Bundler himself knows nothing about Rails and the current environment.

+137
Jun 06 2018-12-06T00:
source share

An alternative solution is to use bundle-only ruby stone . It can be used as follows:

 > gem install bundle-only > bundle-only production 

This library does not pollute your package configurators or increase Gemfile.lock ; this is a simple alternative to the bundle --without every other group built-in option that bundler provides.

0
Jun 14 '17 at 9:57 on
source share



All Articles