Made a lot of changes: no more functions directory. All aliases have been moved to the new alias directory. Plugins are now for functions only. Updated the README to reflect the changes and add a contributor's list.

This commit is contained in:
Robert R Evans
2010-10-10 09:24:19 -07:00
parent 4f3462b6d1
commit 2010f011f8
20 changed files with 102 additions and 70 deletions

View File

@@ -1,16 +1,39 @@
#!/bin/bash
# Desktop Programs
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'"
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'"
alias preview="open -a '$PREVIEW'"
alias xcode="open -a '/Developer/Applications/Xcode.app'"
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
alias safari="open -a safari"
alias firefox="open -a firefox"
alias dashcode="open -a dashcode"
# For generic functions.
function ips {
ifconfig | grep "inet " | awk '{ print $2 }'
}
function myip {
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo "Your public IP is: ${bold_green} $res ${normal}"
}
if [ -s /usr/bin/firefox ] ; then
unalias firefox
fi
# View man documentation in Preview
pman () {
man -t "${1}" | open -f -a $PREVIEW
}
pcurl() {
curl "${1}" | open -f -a $PREVIEW
}
pri() {
ri -T "${1}" | open -f -a $PREVIEW
}
# disk usage per directory
usage ()
{
if [ $1 ]
then
du -hd $1
else
du -hd 1
fi
}

View File

@@ -1 +0,0 @@
alias em="emacs"

View File

@@ -1,54 +0,0 @@
#!/bin/bash
# Aliases
alias g='git'
alias get='git'
alias gst='git status'
alias gs='git status'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gco='git checkout'
alias gexport='git archive --format zip --output'
case $OSTYPE in
linux*)
alias gd='git diff | vim -R -'
;;
darwin*)
alias gd='git diff | mate'
;;
darwin*)
alias gd='git diff'
;;
esac
function git-help() {
echo "Git Custom Aliases Usage"
echo
echo " g = git"
echo " gst/gs = git status"
echo " gl = git pull"
echo " gup = git fetch && git rebase"
echo " gp = git push"
echo " gd = git diff | mate"
echo " gdv = git diff -w \"$@\" | vim -R -"
echo " gc = git commit -v"
echo " gca = git commit -v -a"
echo " gb = git branch"
echo " gba = git branch -a"
echo " gcount = git shortlog -sn"
echo " gcp = git cherry-pick"
echo " gco = git checkout"
echo " gexport = git git archive --format zip --output"
echo
}

20
plugins/git.plugins.bash Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
function git_remote {
echo "Running: git remote add origin ${GIT_HOSTING}:$1.git"
git remote add origin $GIT_HOSTING:$1.git
}
function git_first_push {
echo "Running: git push origin master:refs/heads/master"
git push origin master:refs/heads/master
}
function git_remove_missing_files() {
git ls-files -d -z | xargs -0 git update-index --remove
}
# Adds files to git's exclude file (same as .gitignore)
function local-ignore() {
echo "$1" >> .git/info/exclude
}

View File

@@ -1,56 +0,0 @@
#!/bin/bash
# heroku
alias h='heroku'
alias hl='heroku list'
alias hi='heroku info'
alias ho='heroku open'
# dynos and workers
alias hd='heroku dynos'
alias hw='heroku workers'
# rake console
alias hr='heroku rake'
alias hcon='heroku console'
# new and restart
alias hnew='heroku create'
alias hrestart='heroku restart'
# logs
alias hlog='heroku logs'
alias hlogs='heroku logs'
# maint
alias hon='heroku maintenance:on'
alias hoff='heroku maintenance:off'
# heroku configs
alias hc='heroku config'
alias hca='heroku config:add'
alias hcr='heroku config:remove'
alias hcc='heroku config:clear'
function heroku-help() {
echo "Heroku Aliases Usage"
echo
echo " h = heroku"
echo " hl = heroku list"
echo " hi = heroku info"
echo " ho = heroku open"
echo " hd = heroku dynos"
echo " hw = heroku workers"
echo " hr = heroku rake"
echo " hcon = heroku console"
echo " hnew = heroku create"
echo " hrestart = heroku restart"
echo " hlog = heroku logs"
echo " hon = heroku maintenance:on"
echo " hoff = heroku maintenance:off"
echo " hc = heroku config"
echo " hca = heroku config:add"
echo " hcr = heroku config:remove"
echo " hcc = heroku config:clear"
echo
}

14
plugins/hg.plugins.bash Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
hg_dirty() {
hg status --no-color 2> /dev/null \
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
| sort | uniq | head -c1
}
hg_in_repo() {
[[ `hg branch 2> /dev/null` ]] && echo 'on '
}
hg_branch() {
hg branch 2> /dev/null
}

View File

@@ -0,0 +1,17 @@
#!/bin/bash
#
# The install directory is hard-coded. TOOD: allow the directory to be specified on the command line.
#
function rails_jquery {
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
}
function jquery_install {
curl -o public/javascripts/jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
}
function jquery_ui_install {
curl -o public/javascripts/jquery_ui.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js
}

View File

@@ -0,0 +1,50 @@
#!/bin/bash
function nginx_reload() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Reloading NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -HUP $PID
else
echo "Nginx pid file not found"
return 0
fi
}
function nginx_stop() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
else
echo "Nginx pid file not found"
return 0
fi
}
function nginx_start() {
FILE="${NGINX_PATH}/sbin/nginx"
if [ -e $FILE ]; then
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Couldn't start nginx"
fi
}
function nginx_restart() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
sleep 1
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Nginx pid file not found"
return 0
fi
}

View File

@@ -1,7 +1,5 @@
#!/bin/bash
alias f='open -a Finder '
function tab() {
osascript 2>/dev/null <<EOF
tell application "System Events"

View File

@@ -1,41 +0,0 @@
#!/bin/bash
# Rails Commands
alias r='rails'
alias rg='rails g'
alias rs='rails s'
alias rc='rails c'
alias rn='rails new'
alias rd='rails dbconsole'
alias rp='rails plugin'
alias ra='rails application'
alias rd='rails destroy'
alias ss='script/server'
alias ts="thin start" # thin server
alias sc='script/console'
alias restartapp='touch tmp/restart.txt'
alias restart='touch tmp/restart.txt' # restart passenger
alias devlog='tail -f log/development.log'
alias taild='tail -f log/development.log' # tail dev log
function rails-help() {
echo "Rails Aliases Usage"
echo
echo " r = rails"
echo " rg = rails generate"
echo " rs/ss = rails server"
echo " ts = thin server"
echo " rc/sc = rails console"
echo " rn = rails new"
echo " rd = rails dbconsole"
echo " rp = rails plugin"
echo " ra = rails application"
echo " rd = rails destroy"
echo " restartapp = touch tmp/restart.txt"
echo " restart = touch tmp/restart.txt"
echo " devlog = tail -f log/development.log"
echo " taild = tail -f log/development.log"
echo
}

View File

@@ -1,5 +0,0 @@
#!/bin/bash
# Textmate
alias e='mate . &'
alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &'

View File

@@ -1,4 +0,0 @@
#!/bin/bash
alias v='mvim --remote-tab'