Last active
December 10, 2015 10:39
-
-
Save ncuesta/4422630 to your computer and use it in GitHub Desktop.
Short script to keep an updated local copy of Ruby on Rails master branch and run commands using that version rather than a global stable version of the framework.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Keep an updated local copy of Ruby on Rails | |
# and use it to run commands, rather than the | |
# version you might have installed as a gem | |
# on your system | |
# | |
# @author ncuesta | |
# Customize this with your own fork | |
RAILS_REPO='https://github.com/rails/rails' | |
# Path to the local copy of Rails | |
LOCAL_RAILS=~/.rails-master | |
# Clone or update a local copy of Rails | |
if [ ! -d $LOCAL_RAILS ]; then | |
git clone $RAILS_REPO $LOCAL_RAILS | |
else | |
pushd $LOCAL_RAILS | |
git pull | |
popd | |
fi | |
# Try to run Rails with the given arguments | |
RAILS=$LOCAL_RAILS/railties/bin/rails | |
if [ -x $RAILS ]; then | |
$RAILS $* | |
else | |
echo "Unable to find Rails executable" | |
echo "(Tried at $RAILS)." | |
echo "Did the git clone end correctly?" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment