belgoros
belgoros

Reputation: 3928

Skip non-development environment gems installation

I have some gems needed outside development environment. So I moved them to the corresponding group in Gemfile as follows:

group :staging, :production do
  gem 'activerecord-oracle_enhanced-adapter', '~> 5.2.0'
  gem 'ruby-oci8',                            '~> 2.2', '>= 2.2.7'
  gem 'aws-sdk-s3', '~> 1.48', require: false
end

Nevertheless, after cloning the project, when running bundle install it still requires to install ruby-oci8. What am I missing?

Upvotes: 0

Views: 968

Answers (1)

RomanOks
RomanOks

Reputation: 722

By default, bundle install will install all gems in all groups in your Gemfile, except those declared for a different platform.

However, you can explicitly tell Bundler to skip installing certain groups with the --without option. This option takes a space-separated list of groups.

While the --without option will skip installing the gems in the specified groups, it will still download those gems and use them to resolve the dependencies of every gem in your Gemfile.

This is so that installing a different set of groups on another machine (such as a production server) will not change the gems and versions that you have already developed and tested against.

ref: https://bundler.io/man/bundle-install.1.html

Upvotes: 1

Related Questions