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?
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
Gemfiles. Gemfiles require at least one gem source, in the form of the URL for a RubyGems server. Generate a Gemfile with the default rubygems.org source by running bundle init . If you can, use https so your connection to the rubygems.org server will be verified with SSL.
We see there are two groups (:development and :test) added to our Gemfile. This helps us in installing gems only for specific environments. Gems installed in the development group will only be available in the development environment and the same goes for the rest.
A Gemfile is a ruby file that defines your ruby dependencies. Here is an existing one from a Cocoa project. source 'https://rubygems.org' gem 'cocoapods' gem 'cocoapods-keys' gem 'fui', '~> 0.3.0' gem 'xcpretty' gem 'second_curtain', '~> 0.2.3' gem 'fastlane'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With