Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (41 sloc) 2.06 KB
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory.
# For more info, see: http://beginrescueend.com/
ruby_gemset_name="ruby-1.9.2-p290@interview-challenges"
ruby_name="ruby-1.9.2-p290"
echo "RVM: Using ${ruby_gemset_name} for this project."
# Ensure we have the right ruby installed to use this project.
if rvm list strings | grep -q "${ruby_name}" ; then
# Load or create the specified environment
# We attempt to load the desired environment directly from the environment
# file. This is very fast and efficient compared to running through the entire
# CLI and selector. If you want feedback on which environment was used then
# insert the word 'use' after --create as this triggers verbose mode.
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
&& -s "${rvm_path:-$HOME/.rvm}/environments/${ruby_gemset_name}" ]] ; then
\. "${rvm_path:-$HOME/.rvm}/environments/${ruby_gemset_name}"
else
# If the environment file has not yet been created, use the RVM CLI to select.
if ! rvm --create "${ruby_gemset_name}"
then
echo "RVM: Failed to create environment '$environment_id'."
fi
fi
# Ensure that Bundler is installed, install it if it is not.
bundler_installed=`gem list bundler | grep bundler`
if [ -z "$bundler_installed" ]; then
gem install bundler
fi
# Bundle while reducing excess noise.
# We generate bin stubs so that we don't need to use
# 'bundle exec' before gem executables. You should add
# './bin' to your path so that you can run 'rake', 'cucumber'
# etc from the Gemfile with ease.
# See http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/
echo "RVM: Ensuring your bundle is up to date."
bundle install | grep -v 'Using' | grep -v 'complete' | sed '/^$/d'
else
# Notify the user to install the desired interpreter before proceeding.
echo "RVM: ${ruby_name} was not found, please run 'rvm install ${ruby_name}' and then cd back into the project directory."
fi
Something went wrong with that request. Please try again.