90 lines
2.2 KiB
Plaintext
90 lines
2.2 KiB
Plaintext
function activate_virtualenv() {
|
|
if [ -f env/bin/activate ]; then . env/bin/activate;
|
|
elif [ -f ../env/bin/activate ]; then . ../env/bin/activate;
|
|
elif [ -f ../../env/bin/activate ]; then . ../../env/bin/activate;
|
|
elif [ -f ../../../env/bin/activate ]; then . ../../../env/bin/activate;
|
|
fi
|
|
}
|
|
|
|
function git-new-remote-tracking {
|
|
git checkout -b $1 && git push -u origin $1
|
|
}
|
|
|
|
function git_branch_name {
|
|
val=`git branch 2>/dev/null | grep '^*' | colrm 1 2`
|
|
echo "$val"
|
|
}
|
|
|
|
function git-done {
|
|
branch=`git_branch_name`
|
|
git checkout master && git merge $branch --ff-only && bundle install && rake db:migrate db:test:prepare && rake && git push && git branch -D $branch && git push origin :$branch
|
|
}
|
|
|
|
function git-nuke {
|
|
git branch -D $1 && git push origin :$1
|
|
}
|
|
|
|
function git-on-master {
|
|
branch=`git_branch_name`
|
|
git checkout master && git pull --rebase
|
|
git checkout $branch
|
|
git rebase master
|
|
}
|
|
|
|
function g {
|
|
if [[ $# > 0 ]]; then
|
|
git $@
|
|
else
|
|
git status
|
|
fi
|
|
}
|
|
compdef g=git
|
|
|
|
function rrg {
|
|
rake routes | grep $1
|
|
}
|
|
|
|
function take {
|
|
mkdir $1
|
|
cd $1
|
|
}
|
|
|
|
# Allows commit message without typing quotes (can't have quotes in the commit msg though).
|
|
function gc {
|
|
git commit -m "$*"
|
|
}
|
|
|
|
# Search google for a term
|
|
function google() {
|
|
open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q= $1";
|
|
}
|
|
|
|
# Open a file in chrome
|
|
function chrome () {
|
|
open -a /Applications/Google\ Chrome.app/ "$1"
|
|
}
|
|
|
|
# Open a file in chrome
|
|
function chrome-kiosk () {
|
|
open -a /Applications/Google\ Chrome.app/ --args --kiosk --no-first-run --no-default-browser-check --noerrdialogs --no-message-box --disable-desktop-notifications --allow-running-insecure-content --always-authorize-plugins --allow-outdated-plugins "$1"
|
|
}
|
|
|
|
|
|
# See top 10 bash commands
|
|
function hist() {
|
|
cat ~/.history|cut -d ';' -f 2- 2>/dev/null| awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
|
|
}
|
|
|
|
function bump_gem_version {
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "usage: $0 <version>"
|
|
else
|
|
echo "Committing version bump"
|
|
git add . && git commit -m "Version ${1}"
|
|
echo "Creating tag v$1"
|
|
git tag -a v${1} -m "Tagging v${1}"
|
|
git push origin && git push origin --tags
|
|
fi
|
|
}
|
|
|