Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Install the pre-release of bundler. When 1.0 is final the --pre flag will not be necessary.

$ gem install bundler --version=1.0.0.rc.2
Successfully installed bundler-1.0.0.rc.2
1 gem installed

Modify your Gemfile, and locally re-bundle you app with the new bundler options. If bundler complains about the Gemfile format, fix it according to the directions on http://gembundler.com/v1.0/index.html. If you have an old bundler gem defined in your Gemfile, make sure to un-pin it from 0.9.x.

$ echo >> Gemfile
$ bundle install --path vendor/bundle
Fetching source index for http://rubygems.org/
Installing rack (1.2.1) 
Installing sinatra (1.0) 
Using bundler (1.0.0.rc.2) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Your bundle was installed to `vendor/bundle`

Change how bundler is invoked in your app's bootup and test your application. Sample config.ru:

require 'rubygems'
require 'bundler'
Bundler.setup

require 'sinatra'
require 'web'

run Sinatra::Application

Commit the modified Gemfile and the Gemfile.lock. The Gemfile.lock contains the full list of gem dependencies and helps keep your gems in sync across multiple developers and on Heroku.

$ git add Gemfile Gemfile.lock && git commit -m 'bundler 1.0 Gemfile and lock'
[master 8312d83] bundler 1.0 Gemfile and lock
 2 files changed, 12 insertions(+), 0 deletions(-)
 create mode 100644 Gemfile.lock

$ echo 'vendor/bundle' > .gitignore
$ git add .gitignore && git commit -m 'ignore bundled gems'
[master 1ed0b4a] ignore bundled gems
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore

Push to Heroku, and compare the Bundler output to your local install. It is important that you push a modified Gemfile ensure that Heroku will re-bundle your application.

$ git push heroku master
Counting objects: 15, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (13/13), 1.39 KiB, done.
Total 13 (delta 4), reused 0 (delta 0)

-----> Heroku receiving push
-----> Sinatra app detected
-----> Gemfile detected, running Bundler version 1.0.0.rc.2
       Unresolved dependencies detected; Installing...
       Fetching source index for http://rubygems.org/
       Installing rack (1.2.1) 
       Installing shotgun (0.8) 
       Installing sinatra (1.0) 
       Using bundler (1.0.0.rc.2) 
       Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
       Your bundle was installed to `.bundle/gems`
       Compiled slug size is 260K
-----> Launching..... done
       http://bundler-test.heroku.com deployed to Heroku

To git@heroku.com:bundler-test.git
   9f92823..a15e5be  master -> master

From here on out, when you change your Gemfile, run bundle install and commit the new Gemfile and Gemfile.lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.