Ruby, RVM, and Bundler Demystified

Like any train locomotive, it needs tracks on which to travel (Ruby runtime), some form of energy bits (Ruby gems, application dependencies), and, of course, an engineer (You)!Everything is pretty simple to start..The train can run on pre-laid tracks (default system Ruby runtime) and those tracks can supply the energy bits to the train from something like a third rail (by installing any application dependencies as they are encountered, e.g. `sudo gem install foo`).Now, let’s add an additional train to the system..That seems easy, we can run it down the same tracks as our first train, thereby using the same energy source too..But what happens when this new train needs to run on newer or older tracks (a different Ruby version) than the first train?This can happen if you are trying to retrofit an older train to fit new tracks, or if the latest tracks work better or have better features than the old tracks..Sometimes a new energy bit may even require the new tracks!.And more, the energy bits are bound to those various tracks as well.Enter RVM, the ruby version manager..This nifty command-line utility allows the engineer to use more than one track by trivially switching the tracks as they engineer each train (`rvm use 2.4.1`)..Now the trains can safely travel their appropriate tracks..But what about the energy source?.What happens if this new train needs different energy bits — or worse, similar but not-exactly-the-same bits (different application dependency versions)..RVM provides a concept of a ‘gemset’, which allows the engineer to switch or share the third rail as well..RVM makes it easy to remove tracks and can keep all of the tracks safe from collision with one another, or with the pre-installed system tracks.So this is great!. More details

Leave a Reply