Gemfile group used for?

I know that the "group" method is used to define gems for specific environments.

group :development, :test do gem "rspec-rails", ">= 2.0.0.beta.19" gem "cucumber-rails", ">= 0.3.2" gem "webrat", ">= 0.7.2.beta.1" end 

But I do not understand what this means. So they can only be used if they are in a development and testing environment?

But will it be installed in production?

+4
source share
2 answers

This means that you do not need this stone in production. But if you want to use test or development mode, you need it.

You can install without any group using bundler, for example:

 bundle install --without= development test 

In this case, all the gems in the development and testing group are not installed and are not required.

+10
source

// A group can be included or retrieved whenever we need to install a gem package

Suppose that we have the following group for production and production, we do not want them to be included when installing gems

 group :staging, :production do gem 'libv8' gem 'piwik_analytics', '~> 1.0.1' end 

So, install without staging or production group

bundle install --without staging proudction

0
source

All Articles