Groups in a Gemfile in Rails 3?
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.
Gems groups in the Gemfile for rails
If you are using the exact gems for all of the environments, you don't need to specify it in group.
You can find more about bundler groups here :
http://yehudakatz.com/2010/05/09/the-how-and-why-of-bundler-groups/
http://bundler.io/v1.3/groups.html
Gemfile group is used for?
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.
Bundler - updating gems in a particular group
Yes, with
$ bundle update --conservative --group test development
Bundler’s --conservative
option is key, because it prevents updates in any "Production" gem that is also a dependency of a "Test" or "Development" gem.
How is the :assets group in rails 3.1 handled by bundler?
The code that handles :assets
group placed in config\application.rb
. In rails 3.1 it is:
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
how to install production group in the Gemfile
in your .bundle/config
file you probably have this line:
BUNDLE_WITHOUT: production
Just delete this line, and the bundle install
will also install the gems from the production
group
Related Topics
Rails Sitemap_Generator Uninitialized Constant
Os X Mavericks Install Rvm Warning
How to Get a Hash Value by Numeric Index
Ip Range to Cidr in Ruby/Rails
Ways to Define a Global Method in Ruby
After Ruby 2.4 Upgrade - Error While Trying to Load The Gem 'Uglifier' (Bundler::Gemrequireerror)
How to Download a Ruby Gem Without Installing It Automatically
Using Authlogic_API for Rails Rest API Access
Which Ruby Rest API Client for Neo4J
Rails 5, "Nil Is Not a Valid Asset Source"
Best Practice for Limiting the Number of Associations Within a Has_Many Relationship
Does Anyone Know How to Appropriately Deal with User Timezones in Rails 2.3
How to Start Using Xiki in Emacs
What's The Impact of Eager_Load=True
Gem Install Dm-Postgres-Adapter Build Error
Using Rvm, But Can't Set Current Ruby Version (Ubuntu 11.10)