← Back to Upcase

Bundler gem groups all being loaded on local

(Brian Dear) #1

Currently, I have to do this: bundle install --without red:green:staging:production on local to ensure that red environment gems (as well as green) don’t load locally. My local environment is, in fact running in the development env – is there a way to adds something somewhere so I don’t have to exclude gem groups explicitly on a bundle (for local only.)
I thought that was normally the default (to only load gems for the specific environment based on gem groups) but this app I’m working on seems to want to load everything.

(George Brocklehurst) #2

You should only need to specify the groups you want to exclude once. According to the bundle install man page, Bundler will remember the groups you excluded:

Some options (marked above in the OPTIONS section) are remembered between calls to bundle install, and by the Bundler runtime.

For instance, if you run bundle install --without test, a subsequent call to bundle install that does not include a --without flag will remember your previous choice.

Rails will only load the Gems from the group with the same name as the current environment and any Gems in the default group, but this doesn’t effect the bundle install command.