Jun 12, 2011 posted by Joel

RVM + Rails + Bundler without the Gemset Pollution Bullshit

Every tutorial I have ever seen about using RVM, Rails, and Bundler together seems to get this wrong afaik. Why‽ Misunderstanding bundler, maybe?

So, the typical thing they tell you is basically these steps:

  1. Install RVM
  2. Install you some rubies
  3. Make a Rails gemset
  4. Install Bundler (if you don’t want it in your default gemset; YOU DO)
  5. Install the Rails gem
  6. Generate a new Rails app
  7. Bundle the gems for that Rails app
  8. … Mad Cash

There’s a problem with that, though. You end up having rails and a bunch of other crap in your gemset that doesn’t actually need to be there. I am of the opinion that the order should be like this (my list is somewhat more command-centric so you know what to do):

  1. Install RVM
  2. Put bundler in your global gemset
  3. Install you some rubies (1.9.2! 1.9.2!; should be yelled much like the too much beer bro U.S.A.! U.S.A.!)
  4. Create a directory for you new Rails app (~/projects/omgponies)
  5. git init
  6. Make a .rvmrc in the directory that will create the gemset (contents might be something like: rvm ruby-1.9.2-p180@rails3 --create
  7. Make a Gemfile in the directory with just the rails gem in it
  8. bundle install
  9. bundle exec rails new . (creating a new Rails app in the current directory; the rails app will be named the same as the dir; say yes when it asks to overwrite Gemfile)
  10. bundle install
  11. … Mad Cash

Now your rails app is ready to go, and your gemset doesn’t have an extra 87 gems in it. :D

comments (0)


Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Powered by WP Hashcash