Created
February 24, 2011 03:10
-
-
Save tissak/841687 to your computer and use it in GitHub Desktop.
Sutto's global rails 2 & 3 starter scripts
This file contains 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
rails_version() { | |
which -s rails && rails -v 2>/dev/null | sed 's/Rails //' | |
} | |
r() { | |
local name="$1" | |
shift | |
if [[ -z "$name" ]]; then | |
echo "Usage: $0 command *args" >&2 | |
return 1 | |
fi | |
if [[ -x "./script/$name" ]]; then | |
./script/$name $@ | |
elif [[ -x "./script/rails" ]]; then | |
./script/rails "$name" $@ | |
elif [[ -n "$(rails_version | grep '^3')" ]]; then | |
rails "$name" $@ | |
else | |
echo "Please change to the root of your project first." >&2 | |
return 1 | |
fi | |
} | |
alias ss="r server" | |
alias sc="r console" | |
alias sp='r plugin' | |
alias sg='r generate' | |
alias sd="r dbconsole" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment