11c087d7ffe0

Major refactoring.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 07 Oct 2009 00:28:58 -0400
parents a92c2fa08ceb
children ae4c1a5f6221
branches/tags (none)
files .bashrc bash/mercurial bash/pip bash/prompt bash/subversion bash/tasks

Changes

--- a/.bashrc	Wed Oct 07 00:06:27 2009 -0400
+++ b/.bashrc	Wed Oct 07 00:28:58 2009 -0400
@@ -2,7 +2,6 @@
 alias less='less -R '
 alias hl='less -R'
 alias pm='python manage.py '
-alias mq='hg -R $(hg root)/.hg/patches'
 alias oo='open .'
 alias flakes="find . -name '*.py' -print0 | xargs -0 pyflakes"
 alias fab='fab -i ~/.ssh/stevelosh'
@@ -21,7 +20,6 @@
 export EDITOR='vim'
 export PATH="/usr/local/bin:~/lib/fmscripts:${PATH}"
 export WORKON_HOME="${HOME}/lib/virtualenvs"
-export PIP_VIRTUALENV_BASE=$WORKON_HOME
 export GREP_OPTIONS='--color=auto'
 export HISTSIZE=1000
 export HISTFILESIZE=1000
@@ -31,81 +29,20 @@
 export COMMAND_MODE=unix2003
 export R_LIBS="$HOME/lib/r"
 
-# Accomodate the updated version of Subversion -------------------------------
-export DYLD_LIBRARY_PATH="/opt/subversion/lib:$DYLD_LIBRARY_PATH"
-export PYTHONPATH="/opt/subversion/lib/svn-python:$PYTHONPATH"
-export PATH="/opt/subversion/bin:$PATH"
-
 # Extra shell extensions like j and tab completion for Mercurial -------------
 source ~/lib/j2/j.sh
 source ~/lib/hg/bash_completion
 source ~/lib/virtualenvwrapper_bashrc
 
-# Wrap pip to prevent stupid mistakes ----------------------------------------
-export PIP_BIN="`which pip`"
-alias pip-sys="$PIP_BIN"
-pip() {
-    if [ -n "$VIRTUAL_ENV" ]
-    then $PIP_BIN -E "$VIRTUAL_ENV" "$@"
-    else echo "Not currently in a venv -- use pip-sys to work system-wide."
-    fi
-}
-
-# Task stuff -----------------------------------------------------------------
-alias t='~/src/t/t.py --task-dir="~/tasks"'
-alias m='~/src/t/t.py --task-dir="~/tasks" --list=music'
-alias g='~/src/t/t.py --task-dir="~/tasks" --list=groceries'
-alias k='~/src/t/t.py --task-dir="~/tasks" --list=books'
-alias p='~/src/t/t.py --task-dir="~/tasks" --list=pack'
-alias b='~/src/t/t.py --list=bugs'
-
-alias pa='~/src/t/t.py --task-dir="~/tasks" --list=pack-archive'
-packfor() {
-    cp "$HOME/tasks/pack-archive" "$HOME/tasks/pack";
-    touch "$HOME/tasks/.pack.done"
-    hg -R ~/tasks add 'pack' '.pack.done';
-    hg -R ~/tasks com -m 'Starting to pack.'
-}
+# Separate stuff -------------------------------------------------------------
+source ~/.bash/mercurial
+source ~/.bash/subversion
+source ~/.bash/tasks
+source ~/.bash/pip
+source ~/.bash/prompt
 
 # Useful functions -----------------------------------------------------------
 
-pull_everything() {
-    for repo in $( ls -1 ); do
-        if [[ -d $repo && -d $repo/.hg ]]; then
-            echo "Pulling" $repo
-            hg -R $repo pull -u
-            echo
-        fi
-    done
-}
-
 wo() {
     [ -f './.venv' ] && workon `cat ./.venv`
 }
-
-# Prompt stuff ---------------------------------------------------------------
-
-D=$'\[\e[37;40m\]'
-PINK=$'\[\e[35;40m\]'
-GREEN=$'\[\e[32;40m\]'
-ORANGE=$'\[\e[33;40m\]'
-
-hg_ps1() {
-  hg prompt "\
-{${D} on ${PINK}{branch}}\
-{${D} at ${ORANGE}{tags|${D}, ${ORANGE}}}\
-{${GREEN}{status|modified|unknown}}{${GREEN}{update}}" 2> /dev/null
-}
-
-tasks_ps1() {
-    t | wc -l | sed -e's/ *//'
-}
-
-render_ps1() {
-  echo "\n\
-${PINK}\u ${D}at ${ORANGE}\h ${D}in ${GREEN}\w$(hg_ps1)${D}\n\
-[$(tasks_ps1)] $([ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' )$ "
-}
-
-PROMPT_COMMAND="$(echo "$PROMPT_COMMAND"|sed -e's/PS1="`render_ps1`";//g')"
-PROMPT_COMMAND='PS1="`render_ps1`";'"$PROMPT_COMMAND"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bash/mercurial	Wed Oct 07 00:28:58 2009 -0400
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+alias mq='hg -R $(hg root)/.hg/patches'
+
+pull_everything() {
+    for repo in $( ls -1 ); do
+        if [[ -d $repo && -d $repo/.hg ]]; then
+            echo "Pulling" $repo
+            hg -R $repo pull -u
+            echo
+        fi
+    done
+}
+
+bitb() {
+    local P="$(grep 'bitbucket.org' `hg root`/.hg/hgrc 2>/dev/null | head -1)"
+    local URL="$(echo $P | sed -e's|.*\(bitbucket.org.*\)|http://\1|')"
+    [[ -n $URL ]] && open $URL || echo "No BitBucket path found!"
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bash/pip	Wed Oct 07 00:28:58 2009 -0400
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+export PIP_VIRTUALENV_BASE=$WORKON_HOME
+
+PIP_BIN="`which pip`"
+alias pip-sys="$PIP_BIN"
+
+pip() {
+    if [ -n "$VIRTUAL_ENV" ]
+    then $PIP_BIN -E "$VIRTUAL_ENV" "$@"
+    else echo "Not currently in a venv -- use pip-sys to work system-wide."
+    fi
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bash/prompt	Wed Oct 07 00:28:58 2009 -0400
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+D=$'\[\e[37;40m\]'
+PINK=$'\[\e[35;40m\]'
+GREEN=$'\[\e[32;40m\]'
+ORANGE=$'\[\e[33;40m\]'
+
+hg_ps1() {
+  hg prompt "\
+{${D} on ${PINK}{branch}}\
+{${D} at ${ORANGE}{tags|${D}, ${ORANGE}}}\
+{${GREEN}{status|modified|unknown}}{${GREEN}{update}}" 2> /dev/null
+}
+
+tasks_ps1() {
+    t | wc -l | sed -e's/ *//'
+}
+
+render_ps1() {
+  echo "\n\
+${PINK}\u ${D}at ${ORANGE}\h ${D}in ${GREEN}\w$(hg_ps1)${D}\n\
+[$(tasks_ps1)] $([ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' )$ "
+}
+
+PROMPT_COMMAND="$(echo "$PROMPT_COMMAND"|sed -e's/PS1="`render_ps1`";//g')"
+PROMPT_COMMAND='PS1="`render_ps1`";'"$PROMPT_COMMAND"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bash/subversion	Wed Oct 07 00:28:58 2009 -0400
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# Accomodate the updated version of Subversion
+export DYLD_LIBRARY_PATH="/opt/subversion/lib:$DYLD_LIBRARY_PATH"
+export PYTHONPATH="/opt/subversion/lib/svn-python:$PYTHONPATH"
+export PATH="/opt/subversion/bin:$PATH"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bash/tasks	Wed Oct 07 00:28:58 2009 -0400
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+alias t='~/src/t/t.py --task-dir="~/tasks"'
+alias m='~/src/t/t.py --task-dir="~/tasks" --list=music'
+alias g='~/src/t/t.py --task-dir="~/tasks" --list=groceries'
+alias k='~/src/t/t.py --task-dir="~/tasks" --list=books'
+alias p='~/src/t/t.py --task-dir="~/tasks" --list=pack'
+alias b='~/src/t/t.py --list=bugs'
+
+alias pa='~/src/t/t.py --task-dir="~/tasks" --list=pack-archive'
+packfor() {
+    cp "$HOME/tasks/pack-archive" "$HOME/tasks/pack";
+    touch "$HOME/tasks/.pack.done"
+    hg -R ~/tasks add 'pack' '.pack.done';
+    hg -R ~/tasks com -m 'Starting to pack.'
+}
\ No newline at end of file