Last Updated: February 25, 2016
·
532
· sjtipton

Manage bundles on many Ruby projects with differing versions

Our team has many different projects going on, and not all are using Ruby 2.0 as of yet. From an organizational standpoint, I split my local repos up into a directory structure:

/Users/steve/code/rails/ruby-1.9.3/

and

/Users/steve/code/rails/ruby-2.x.x/

Each project's Gemfile specifies the ruby version, a la Heroku. With the recent release of Ruby 2.0.0-p247, 1.9.3-p448, etc., it was wise to upgrade. Of course, this meant needing to run the bundle installation for each project!

To do so, I wrote a little bash script that can help:

ONES=/Users/steve/code/rails/ruby-1.9.3/*/
TWOS=/Users/steve/code/rails/ruby-2.x.x/*/

for d in $ONES
do
  cd $d
  echo "Bundle install $d"
  bundle install
done

for d in $TWOS
do
  cd $d
  echo "Bundle install $d"
  bundle install
done

Hope this helps!