never_had_a_name
never_had_a_name

Reputation: 93186

Gemfile group is used for?

I know the "group" method is used for specify 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 dont get what it means. So these could just be used when im in development and test environment?

But will it be installed in production?

Upvotes: 16

Views: 9873

Answers (2)

shingara
shingara

Reputation: 46914

It means you don't need this gem in production. But if you want use test or development mode, you need it.

You can install without some group with bundler like :

bundle install --without= development test

In this case all gems in development and test group are not installed and not required.

Upvotes: 18

Vinod Joshi
Vinod Joshi

Reputation: 7862

// A group can be include or extract whenever we require while installing the bundle of gems

Suppose we have following group for staging and production, we don't want them to be included while installing gems


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

So, install without the group of staging or production

bundle install --without staging proudction

Upvotes: 0

Related Questions