2

From the look of this:

Bundler.require *Rails.groups(:assets => %w(development test))

These get groups get required when the app launches:

[:default, :development, :assets]

Why should guard get required in your app?

Is there a best practice? e.g.:

group :misc do
  gem "guard"
end
Aaron Gibralter
  • 4,773
  • 3
  • 35
  • 50

1 Answers1

1

Bundler is intelligent enough to only require gems for the current environment. The groups correspond to these environments. If your app is running in the development environment, Bundler requires the gems from that group, but not those from the test group, and so on.

People often put gems in the :development group that they need/want for their dev environment, but not on their production system.

The line

Bundler.require *Rails.groups(:assets => %w(development test))

simply says that Bundler will require the gems from the assets group only for your development and test environment. This stops your assets from being lazily compiled on your production server, where you usually want to deploy precompiled assets.

Simon Ernst
  • 1,430
  • 9
  • 10
  • But ideally, should I use `:require => false` for gems that are in the development group but aren't required by the actual application to run? – Aaron Gibralter Sep 05 '11 at 17:18
  • Yeah -- seems to be the case: http://stackoverflow.com/questions/4800721/bundler-what-is-the-require-false-on-the-gemfile-means – Aaron Gibralter Sep 05 '11 at 17:25