#201
Feb 15, 2010

Bundler

Bundler is the way to manage gem dependencies in Rails 3.0. Learn how to install gems and lock them down in this episode.
Download (17 MB, 9:22)
alternative download for iPod & Apple TV (11.7 MB, 9:22)

Resources

gem install bundler
bundle install
bundle check
bundle help
bundle install --without=test
bundle lock
bundle install --relock
ls ~/.bundle
bundle pack
ls vendor/cache
gem "rails", "3.0.0.beta"
# gem "rails", :git => "git://github.com/rails/rails.git"

gem "sqlite3-ruby", :require => "sqlite3"

# gem "rspec", :group => :test
group :test do
  gem "webrat"
end

gem "will_paginate", ">= 2.3.12"

RSS Feed for Episode Comments -21 comments

1. Tex Feb 15, 2010 at 00:03

Many thanks Ryan !


2. Rob McLarty Feb 15, 2010 at 00:13

Great as always Ryan. Didn't know about the "without" or "lock" options. Thanks!


3. stephen Feb 15, 2010 at 00:13

excellent - thanks


4. hmorad Feb 15, 2010 at 01:58

Very useful as always, thanks


5. Nithin Bekal Feb 15, 2010 at 03:06

I've still not checked out Rails 3 after these many days because I'm developing on a Windows machine. Hoping to set up an Ubuntu virtual OS to check out Rails3, RV and bundler.

Glad to see rails 3 related railscasts since episode 200.


6. Fredrik Feb 15, 2010 at 04:55

@Nithin Bekal

No need for setting up an Ubuntu virtual os.

http://rubyinstaller.org/download.html - Use the 1.8.7 mingw32-package.

http://github.com/vertiginous/pik instead of RVM.

After installation of the Rails pre-gem in your environment. Apply fix mentioned in https://rails.lighthouseapp.com/projects/8994/tickets/3861-script-replaced-by-scriptrails-not-working

And you're up and running on Windows without problems =)


7. Martinos Feb 15, 2010 at 04:59

Still very useful screencast.

Since gems are installed in our home directory, how would we manage an application shared amongst many users ?

Thank you Ryan work your great work.


8. David Clark Feb 15, 2010 at 07:16

Ryan,

Your 'casts are wonderful. I've only been developing in Ruby and Rails for about 2 months, and would not have gotten as far without them.

2 questions:
Because I am such a rookie, I have been reticent to go to 3. Does bundler work' with 2?

(this one may be off-topic) Tryitng to get my head around gems vs plugins. Are plugins not recommended in 3?

Thanks,

dc


9. DGM Feb 15, 2010 at 07:42

Going through the links from last week, I started in on the "5 Things You Can Do Today to Make Your App Ready for Rails 3" link from "Rails 3.0 Beta: 36 Links and Resources To Get You Going" and tried to install bundler for my rails 2.3 app.. but bundler has changed significantly since then.

This episode is great for getting the new syntax, but I'm wondering what the process is to get a rails 2.3 app to use the gems from bundler - I'm not sure if the original code posted is still accurate...


10. Ryan Bates Feb 15, 2010 at 09:30

@Martinos, each user has their own cache, so you'll need to bundle install when switching users. You can also "bundle install /some/path" to change the location to a global one.

@David, @DGM Bundler does support Rails 2.3 but the experience is still being improved. See this gist for how to do it currently: http://gist.github.com/302406

@David, As for plugins vs gems. Plugins are still acceptable, but in Rails 3 there are fewer reasons to do a plugin over a gem since it's now easy to add engines and rake tasks into a gem. I like to use plugins for small, simple additions and gems for larger, full featured projects.


11. Leonid Feb 15, 2010 at 13:32

This episode is great for getting the new syntax.Since gems are installed in our home directory///


12. Felipe Orellana Feb 15, 2010 at 14:15

What about bundler and rvm? because bundler saves the gems in the .bundler directory instead in my rvm specific environment, i see that is incompatible, but i wish to use rvm with bundler, that i miss in this episode. Greetings


13. Ryan Bates Feb 15, 2010 at 15:41

@Felipe, right, currently if you switch Ruby versions with rvm it will attempt to use the same .bundler gems which causes problems. This will be addressed in future versions of Bundler. It looks like the fix is already in the GitHub repo, so I'm guessing it will be in 0.9.6.


14. Daniel Bretoi Feb 15, 2010 at 22:28

@felipe and @ryan:

I've solved that problem by using the install path.

ie. I run:

bundle install vendor/bundle
in my rails root, then I check in the .bundle/config file which is generated. That way the gem files are always stored in a bundle local to the project as opposed to ~/.bundle


15. Daniel Bretoi Feb 15, 2010 at 22:31

I should point out that checking in .bundle/config is a one time operation, and from this point on you can simple run bundle install, since bundler uses the config file from then on.


16. Brad Gessler Feb 16, 2010 at 22:55

Hey folks, Brad from Poll Everywhere here. We’re upgrading to bundler 0.9.5 and ran into a questions using Bundler with git.

First, should the .bundle folder be ignored? If so, there is an issue when another developer pulls a project and runs ‘bundle install’. The bundler gets to the end of the install process and blows up because .bundle/environment.rb is not found. The error messaging isn’t very clear around this problem either, but a ‘bundle lock’ command fixes it since the generates the .bundle folder. I’m positive that .bundle should be ignored in .git because it contains absolute paths to the gem files, so the bundle install command should probably generate this file if its not present.


17. Tammy Cravit Feb 18, 2010 at 09:30

For those trying to get bundler working with existing Rails 2.3 applications, have a look at:

http://gist.github.com/302406

It took a little fiddling (and I discovered a few gem dependencies that were missing in my environment.rb) but the big Rails 2.3 application I'm developing is now working with bundler.


18. Wayne E. Seguin Feb 18, 2010 at 10:13

Very nice screencast.

rvm >= 0.1.15 (rvm update --head) now has built in bundler support (via BUNDLE_PATH), keep an eye on the documentation page for updates:

http://rvm.beginrescueend.com/integration/bundler/

  ~Wayne


19. Natusya Feb 20, 2010 at 01:21

First, should the .bundle folder be ignored?


20. Sean Schofield Feb 22, 2010 at 17:56

Thanks again for another quality screencast. Question: can bundler be used to generate the gemspec for a gem you're releasing?


21. Nithin Bekal Feb 23, 2010 at 07:57

@Fredrik. Thanks for that info. :) I was just about to install virtual OS when I saw your comment.


22. Yuval Feb 23, 2010 at 12:17

Hinestly, this seems like it presents a lot more complexity and overhead than just using config.gem and normal sudo gem installs. Is it required by Rails 3?


23. Nothing Else Feb 24, 2010 at 21:44

Nice one. Thank you Ryan!


24. dstt karte Mar 07, 2010 at 21:39

Its a nice post and this will be useful screencast for me..Its again a good screencast.There is always new information in your every post.


25. serg23 Mar 10, 2010 at 03:45

thanks Ryan ! this a very cool


26. Hi Apr 10, 2010 at 14:13

GOod

http://sickgames.org


27. NickD Apr 12, 2010 at 14:28

Ryan,
One of the things I like about having gems packaged up in the project is the ability to look at the source code of the gems. This has come in handy on several occasions for debugging as well as extending gems. Do you have any pointers on how I would go about doing that when I start working on a Rails 3 project?

Thanks!
Nick


28. Brad Robertson Apr 23, 2010 at 06:01

How'd you get syntax highlighting for the Gemfile? I've searched everywhere for a TMBundle and can't find out


29. bridesmaid dresses Jun 12, 2010 at 01:54

I loved the article. It is very exciting. Thank you for the information. I will be back.


30. Ihor Jun 16, 2010 at 14:51

Thank you very much for this post!


31. Hermes Birkin Jul 11, 2010 at 22:30

Money can`t buy Happiness? Whoever said that doesn`t know where to buy.
Buyhermesbirkin offers the high quality Hermes bags and services.
No matter it is the classic Birkin bag, or the Kelly and Lindy bag, [url=http://www.buyhermesbirkin.com/]Hermes Birkin[/url]
or the latest new designs, you can find them here. Just selecting one,
you will be the next Victoria in the street. – Comes from Shuna Sun


32. hermesbirkin Jul 12, 2010 at 03:14

Money can`t buy Happiness? Whoever said that doesn`t know where to buy.
Buyhermesbirkin offers the high quality Hermes bags and services.
No matter it is the classic Birkin bag, or the Kelly and Lindy bag,
or the latest new designs, you can find them here. Just selecting one,
you will be the next Victoria in the street. – Comes from Shuna Sun


33. nightfall ugg boots Jul 15, 2010 at 20:02

great post,i hope you update asap


34. Telechargement gratuit de logiciels Jul 19, 2010 at 01:43

I was actually looking for this resource a few weeks back. Thanks for sharing with us your wisdom.This will absolutely going to help me in my projects .


35. leos Jul 23, 2010 at 06:29

Your article is very exciting....


38. cheap ugg sale Jul 27, 2010 at 01:09

Well-know ugg has launched the new style,click to our net to share the pleasure it will deliver to you.


38. Investasi Online Terbaru dan Tercepat Jul 28, 2010 at 13:16

complete jobs, however i dream how i be like you


38. timberlandbootsuk Aug 02, 2010 at 02:07

we provide our buyers with an efficient and manageable procurement process covering every phase of the international supply chain and

streamlining trade channels. Also welcome wholesaling, feedback now!


39. channel handbags Aug 03, 2010 at 03:04

Great as always Ryan. Didn't know about the "without" or "lock" options. Thanks!


40. tiffany Earrings Aug 03, 2010 at 20:53

This episode is great for getting the new syntax.Since gems are installed in our home directory/


41. nhljersey Aug 04, 2010 at 22:50

like this post,thank you


42. premature ejaculation Aug 10, 2010 at 16:53

This is a bit tricky for a newbie like me, but I think I can remember this.


43. UGG Boots on sale Aug 10, 2010 at 18:52

Gooooooooooooooooooood luck ~~!!!!!!!


44. free directory list Aug 11, 2010 at 22:41

Thanks for very good information.


45. ramona and beezus download Aug 14, 2010 at 05:58

Gooooooooooooooooooood luck ~~!!!!!!!


46. Timberland UK Aug 16, 2010 at 23:09

Thanks for sharing with us


47. jewelleryuk Aug 17, 2010 at 05:50

Money can`t buy Happiness? Whoever said that doesn`t know where to buy.
Buyhermesbirkin offers the high quality Hermes bags and services.
No matter it is the classic Birkin bag, or the Kelly and Lindy bag,
or the latest new designs, you can find them here. Just selecting one,
you will be the next Victoria in the street. – Comes from Shuna Sun


48. Rip Blu-ray for Mac Aug 18, 2010 at 01:45

Thanks,it's so good.
suport!


49. Jordan basketball shoes Aug 19, 2010 at 00:09

I like this post,thank you! I was actually looking for this resource a few weeks back. Thanks for sharing with us your wisdom.


50. authentic nike shoes Aug 20, 2010 at 18:29

thanks,like this post.


51. wholesale new era caps Aug 20, 2010 at 20:11

These are wonderful! Thank you for finding and sharing


52. converse all star Aug 20, 2010 at 20:49

love converse all star,love yourself.High quality low price.It's fit for you.


53. jimmy choos Aug 21, 2010 at 01:07

it's a good application. Thanks


54. Wholesale Electronics Aug 25, 2010 at 01:05

Discount Wholesale Electronics, Wholesale Cell Phones, Electronic Gadgets and More from the Best Dropship Wholesaler


55. Herve Leger Aug 26, 2010 at 03:08

 Herve Leger


56. louis vuitton shoes Aug 26, 2010 at 21:03

Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets


57. rap Aug 29, 2010 at 08:57

it's a good application. Thanks


58. neverfull Aug 29, 2010 at 23:10

I was actually looking for this resource a few weeks back. Thanks for sharing with us your wisdom.This will absolutely going to help me in my projects .


59. snow boots Aug 30, 2010 at 20:30

Hoping to set up an Ubuntu virtual OS to check out Rails3, RV and bundler.


60. monster energy hats Aug 31, 2010 at 07:42

great article.
hey buddy,this is one of the best posts that I’ve ever seen; you may include some more ideas in the same theme. I’m still waiting for some interesting thoughts from your side in your next post.


61. levis belts Sep 01, 2010 at 20:45

Came across your blog when I was searching bing I have found the bit of info that
I found to be quite useful.


62. blu ray ripper Sep 02, 2010 at 00:16

This is really a nice guide for Newbies like me. Thank you.

Add your comment:

(SKIP THIS ONE)

(required)

(not shown)


(use pastie or gist for code)

sponsored by:
if you want to help:
required:
Get Quicktime Player
Give Back to Open Source