Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save yoshinari-nomura/ac908d458b0be7eb6f4f to your computer and use it in GitHub Desktop.

Select an option

Save yoshinari-nomura/ac908d458b0be7eb6f4f to your computer and use it in GitHub Desktop.
Sample .rvmrc for searching suitable Ruby version from the name of gemset
MY_PROJECT_GEMSET='filebucket'
MY_PROJECT_RUBY_AND_GEMSET=$( \
rvm gemset list_all \
| awk '/^gemset/{ruby = $3}; /^ /{print ruby "@" $1}' \
| grep "@$MY_PROJECT_GEMSET\$" \
| tail -1
)
if [ -n "$MY_PROJECT_RUBY_AND_GEMSET" ]; then
echo "rvm use $MY_PROJECT_RUBY_AND_GEMSET"
rvm use "$MY_PROJECT_RUBY_AND_GEMSET"
else
echo "Not found suitable gemset for $MY_PROJECT_GEMSET... abort"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment