Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created October 7, 2014 16:25
Show Gist options
  • Save dillonhafer/95e265c32d92c0ebbcf2 to your computer and use it in GitHub Desktop.
Save dillonhafer/95e265c32d92c0ebbcf2 to your computer and use it in GitHub Desktop.
Check for the current version of Rails
function rails_version {
if (( $# == 1 )); then
VERSION="$1-stable"
else
VERSION='master'
echo -e "\033[1;33mUsage: rails_version [BRANCH]\033[0m"
echo -e "\033[1;33mExample: rails_version 4-1\033[0m"
fi
URL="https://raw.githubusercontent.com/rails/rails/$VERSION/RAILS_VERSION"
VERSION_NUMBER=$(curl -s $URL)
echo -e "Current Rails version for $VERSION: \033[0;31m$VERSION_NUMBER\033[0m"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment