Bundler is the way to manage gem dependencies in Rails 3.0. Learn how to install gems and lock them down in this episode.
- mp4Full Size H.264 Video (14.9 MB)
- m4vSmaller H.264 Video (9.94 MB)
- webmFull Size VP8 Video (25.7 MB)
- ogvFull Size Theora Video (19.8 MB)
Great as always Ryan. Didn't know about the "without" or "lock" options. Thanks!
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.
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 =)
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.
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.
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?
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...
@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.
This episode is great for getting the new syntax.Since gems are installed in our home directory///
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
@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.
@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
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.
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.
For those trying to get bundler working with existing Rails 2.3 applications, have a look at:
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.
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:
First, should the .bundle folder be ignored?
Thanks again for another quality screencast. Question: can bundler be used to generate the gemspec for a gem you're releasing?
@Fredrik. Thanks for that info. :) I was just about to install virtual OS when I saw your comment.
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?
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?
How'd you get syntax highlighting for the Gemfile? I've searched everywhere for a TMBundle and can't find out
I'm getting the following error when I attempt the reload command you used in your screencast, did bundler change?