Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (72 sloc) 1.91 KB
---
title: How to use Bundler with Rails
---
.container.guide
#intro
Rails comes with baked in support with bundler.
%h2 How to use Bundler with Rails
.contents
.bullet
.description
Install Rails as you normally would. Use sudo
if you would normally use sudo to install gems.
.how
:code
$ gem install rails
.notes
We recommend using rvm for dependable Ruby
installations, especially if you are switching
between different versions of Ruby
.bullet
.description
Generate a Rails app as usual
:code
$ rails new myapp
$ cd myapp
.bullet
.description
Run the server. Bundler is transparently managing
your dependencies!
:code
$ rails server
.bullet
.description
Add new dependencies to your Gemfile as you
need them.
:code
# lang: ruby
gem 'nokogiri'
gem 'geokit'
.bullet
.description
If you want a dependency to be loaded only in
a certain Rails environment, place it in a group
named after that Rails environment
:code
# lang: ruby
group :test do
gem 'rspec'
gem 'faker'
end
.bullet#shared_with_23
.description
You can place a dependency in multiple groups
at once as well
:code
# lang: ruby
group :development, :test do
gem 'wirble'
gem 'ruby-debug'
end
= link_to 'Learn More: Groups', './groups.html', class: 'btn btn-primary'
.bullet
.description
After adding a dependency, if it is not yet
installed, install it
.how
:code
$ bundle install
.notes
This will update all dependencies in your
Gemfile to the latest versions that do not
conflict with other dependencies