简体   繁体   中英

understanding groups in ruby on rails gemfile

I've seen some syntax where

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

or

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

or

group :production do
  # gems...
end

or

group :db do
  # gems..
end

Are there problems with just doing bundle install with ALL the gems? Why do people want to leave out gems? Wouldn't it just be easier if everything was installed all together?

Group's mainly used for segregating gems primarily for environments. Suppose In development environment we want pry in production we won't doing be any debugging task so we won't require pry for more info You can refer yehuda blog

Rebuilding a large project with a lot of gems can take a few minutes. You can cut down on build time by only building what is needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM