Rails 3中的Gemfile中的组? [英] Groups in a Gemfile in Rails 3?

查看:75
本文介绍了Rails 3中的Gemfile中的组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  group:development,:test do 
gem水豚
gemdatabase_cleaner
gemspork
gemlaunchy
结束

组:bdd do
gem黄瓜-rails
gemrspec-rails
end

这是什么是什么意思? -and-why-of-bundler-groups /rel =noreferrer> http://yehudakatz.com/2010/05/09/the-how-and-why-of-bundler-groups/ :


指定群组可让您做两件事。首先,您可以在您的Gemfile中安装
宝石,减去特定的组。例如,Rails
将mysql和pg放入数据库组中,这样如果您只需在ActionPack上使用
,则可以将install --without db捆绑在一起,然后运行
ActionPack测试,而无需执行第二,您可以使用
Bundler.require列出要自动查询的特定组。默认情况下,Bundler.require要求
中的所有宝石都是默认组(这是所有没有明确组的宝石)。
您也可以说Bundler.require(:default,:another_group)需要
特定组。



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 mean?

解决方案

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.

这篇关于Rails 3中的Gemfile中的组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆