Created
July 29, 2012 21:49
-
-
Save wrburgess/3202041 to your computer and use it in GitHub Desktop.
My bash functinos
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
dev () { | |
cd ~/Development | |
if [ ! -z "$1" ]; then | |
cd $1 | |
fi | |
if [ "$2" == "-m" ]; then | |
if [ -e ~/Development/$1/$1.tmproj ]; then | |
open ~/Development/$1/$1.tmproj -a TextMate | |
else | |
open ~/Development/$1 -a TextMate | |
fi | |
fi | |
} | |
rs () { | |
if [ ! -z "$1" ]; then | |
rspec spec/"$1"_spec.rb | |
else | |
say -v Alex "You need to tell me which spec to run!" | |
fi | |
} | |
use () { | |
if [ ! -z "$1" ]; then | |
rvm use "$1" | |
fi | |
} | |
rebundle () { | |
if [ ! -z "$1" ]; then | |
if [ -f "Gemfile.lock" ]; then | |
rm -Rf Gemfile.lock | |
fi | |
rvm --force gemset delete "$1" | |
rvm gemset create "$1" | |
rvm gemset use "$1" | |
bundle | |
fi | |
} | |
base () { | |
if [ -z "$1" ]; then | |
open db/development.sqlite3 -a Base | |
else | |
open "$1" -a Base | |
fi | |
} | |
push () { | |
if [ ! -z "$1" ]; then | |
git push origin "$1" | |
else | |
git push origin master | |
fi | |
} | |
pull () { | |
if [ ! -z "$1" ]; then | |
git pull origin "$1" | |
else | |
git pull origin master | |
fi | |
} | |
switch () { | |
if [ ! -z "$1" ]; then | |
git checkout "$1" | |
else | |
echo "You must provide a branch to switch to! (switch <branch>)" | |
fi | |
} | |
gd () { | |
if [ ! -z "$1" ] && [ ! -z "$2" ]; then | |
git difftool -y "$1" "$2" | |
else | |
git difftool -y | |
fi | |
} | |
list () { | |
if [ ! -z "$1" ]; then | |
tree -aLC "$1" | |
else | |
tree -aLC 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment