Skip to content

Instantly share code, notes, and snippets.

@invisiblefunnel
Created March 13, 2014 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invisiblefunnel/9538009 to your computer and use it in GitHub Desktop.
Save invisiblefunnel/9538009 to your computer and use it in GitHub Desktop.

tl;dr RVM seems to be the standard and most documented tool, but rbenv will work just as well. For more experienced developers, comfortable with Ruby dependency management, ruby-install/chruby is a strong option.

Here are the relevant issues as I see them:

  • You need to have a recent version of Ruby. At some point in the life of a project the version of Ruby will need to be updated. The change could be driven by a security issue, a change in dependencies (upgrading Rails, for instance), performance improvements (generational garbage collection, more robust method cache expiration, etc.).
  • Manually installing Ruby from source is complicated. Download and unpack the tarba... well, you just lost a good chunk of potential contributors.
  • Installing precompiled binaries requires someone to precompile and distribute binaries.
  • Different projects require different Ruby versions.
  • Gems need to be installed for a specific Ruby version.
  • Bundler won't decide which installed version of a gem to use.

If you're wondering why a discussion about managing lanuage versions involves dependency management tools, welcome to the club (and to the tradeoffs of C-extensions and Java interop).

Solutions to the issues listed above manifest in three forms:

  • Ruby installation
  • Version switching
  • Dependency sandboxing

I've been using ruby-install and chruby. All I need is quick install of ruby versions (ruby-install), and automatic version switching by directory (chruby). It's lightweight (read: fits my use case) but requires a better understanding of rubygems/bundler because there is no concept of a dependency sandbox or "gemset". Of course, gemsets were introduced by RVM (right?) and simplify development environments by adding a large layer of complexity. I don't really like gemsets because it's basically a hack which artificially limits which installed gems are visible to Bundler. That said, explaining bundle exec to someone new to Ruby is a challenge (gemsets can alleviate the need for bundle exec; are there other benefits?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment