Skip to content

Instantly share code, notes, and snippets.

@bradgessler
Created July 29, 2011 01:40
Show Gist options
  • Save bradgessler/1112962 to your computer and use it in GitHub Desktop.
Save bradgessler/1112962 to your computer and use it in GitHub Desktop.
rvmrc file that controls the version of Ruby, the Gemset, Rubygems, and Bundler. Use this if you want to control this stuff in your development workflow.
#!/usr/bin/env bash
# Bare minimum Gems that are needed to keep a Ruby development environment in sync. This assumes
# that you use bundler in your workflow to control the installation of all other gems. If you need
# to bump the bundler or rubygem version across your team, change that here, then run bundler and
# and keep going.
RVMRC=1.9.2@my_gem_set
RUBYGEM_VERSION="1.6.2"
BUNDLER_VERSION="1.0.15"
# Make this work with OS X Lion... for now...
if [[ `uname -v` =~ "Darwin Kernel Version 11" ]] ; then
export CC=/usr/bin/gcc-4.2
fi
# # Make sure we're using the right version for ruby
rvm use --create --install $RVMRC
# Enforce a version of Rubygems
if [[ `gem --version` != $RUBYGEM_VERSION ]] ; then
echo "Updating to RubyGems $RUBYGEM_VERSION..."
rvm rubygems $RUBYGEM_VERSION
fi
# Check if bundler is installed
if [[ "command -v bundle" ]] ; then
# Check if we have the right version
if [[ ! (`bundle --version` =~ $BUNDLER_VERSION) ]] ; then
echo "Updating to Bundler $BUNDLER_VERSION..."
gem install bundler -v$BUNDLER_VERSION
fi
else
echo "Installing Bundler $BUNDLER_VERSION..."
gem install bundler -v$BUNDLER_VERSION
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment