开发者

Groups in a Gemfile in Rails 3?

开发者 https://www.devze.com 2023-01-14 17:31 出处:网络
In my Gemfile in Rails I have these groups: group :development, :test do gem \"capybara\" gem \"database_cleaner\"

In my Gemfile in Rails I have these groups:

group :development, :test do
  gem "capybara"
  gem "database_cleaner"
  gem "spork"
  gem "launchy"
end

group :bdd do
  gem "cucumber-rails"
  gem "rspec-rails"
end

What does this mea开发者_开发技巧n?


From http://yehudakatz.com/2010/05/09/the-how-and-why-of-bundler-groups/:

Specifying groups allows you to do two things. First, you can install the gems in your Gemfile, minus specific groups. For instance, Rails puts mysql and pg in a database group so that if you’re just working on ActionPack, you can bundle install --without db and run the ActionPack tests without having to worry about getting the gems installed.

Second, you can list specific groups to autorequire using Bundler.require. By default, Bundler.require requires all the gems in the default group (which is all the gems that have no explicit group). You can also say Bundler.require(:default, :another_group) to require specific groups.


Grouping your dependencies allows you to perform operations on the entire group. See: http://gembundler.com/v1.3/groups.html


Answer updated to Bundler 1.3 -> http://gembundler.com/v1.3/groups.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号