Permalink
Browse files

always git pull on login shell; improve pip handling; correct exports

  • Loading branch information...
C Anthony Risinger
C Anthony Risinger committed Sep 23, 2012
1 parent e31a3be commit 2baa624c5386079a608c169f5e977712692bc195
Showing with 68 additions and 58 deletions.
  1. +2 −0 .../config
  2. +15 −23 .../self/data/profile/boot/bash
  3. +51 −35 .../self/data/profile/etc/bash/interactive
View
@@ -25,3 +25,5 @@
# ellipsis defines
[alias "ellipsis"]
init = !${GIT_DIR}/self/bin/ellipsis init
+[merge]
+ defaultToUpstream = true
@@ -1,31 +1,23 @@
#!/bin/bash
-export PATH="${HOME}/bin:$PATH"
+export PATH=~/bin:"$PATH"
export ELLIPSIS=~/.../self/
-export ELLIPSIS_HOSTS+=" .sta.xtfx.net"
-if [[ $- == *i* ]]; then
- #declare -x TMPDIR=${HOME}/tmp
- declare TMPDIR=${HOME}/tmp
- declare -x _TMPDIR=/tmp/user-${USER}/tmp
+interactive=${-//[^i]}
- ! [[ -d ${_TMPDIR} ]] &&
- (umask 0077; mkdir --parents ${_TMPDIR}) &&
- mkdir ${_TMPDIR}/{dl,misc}
- ! [[ $(readlink -f ${TMPDIR}) == ${_TMPDIR} ]] &&
- rm -f ${TMPDIR} &&
- ln -s ${_TMPDIR} ${TMPDIR}
+[[ -f ~/.../config && ${UID} == ${EUID} ]] && (
+ export GIT_DIR=~/...
+ _0=$(git rev-parse HEAD) &&
+ git pull --quiet &&
+ _1=$(git rev-parse HEAD) &&
+ [[ ${_0} != ${_1} ]]; _e=${?}
+ [[ ${_e} -eq 0 && -n ${interactive} ]] &&
+ git diff --stat ${_0}
+ exit ${_e}
+ ) &&
+ exec ${BASH}
- [[ -f ~/.../config && ${UID} == ${EUID} ]] &&
- ( declare -x GIT_DIR=${HOME}/...
- ref0=$(git rev-parse HEAD)
- git pull
- ref1=$(git rev-parse HEAD)
- [[ ${ref0} != ${ref1} ]] ) &&
- exec ${BASH}
-
- [[ -f ${ELLIPSIS}data/profile/etc/bash/interactive ]] &&
- . ${ELLIPSIS}data/profile/etc/bash/interactive
-fi
+[[ -n ${interactive} && -f ${ELLIPSIS}data/profile/etc/bash/interactive ]] &&
+ . ${ELLIPSIS}data/profile/etc/bash/interactive
@@ -1,42 +1,64 @@
#!/bin/bash
-[[ -r /etc/bash.bashrc ]] &&
- . /etc/bash.bashrc
+export PATH=~/bin:"${PATH}"
+export ELLIPSIS=~/.../self/
-[[ ${TERM} && ${TERM} == dumb ]] &&
- exit 0
-
-if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
- . /etc/bash_completion
-fi
-
-if [ -f /usr/share/git/git-prompt.sh ] && ! shopt -oq posix; then
- . /usr/share/git/git-prompt.sh
-fi
-
-export PROMPT_DIRTRIM=3
export EDITOR='vim'
-export BROWSER='firefox'
-export WORKON_HOME=~/.local/share/venv/
-mkdir -p ${WORKON_HOME}
-. $(type -p virtualenvwrapper.sh || echo /dev/null)
-
+export BROWSER='chromium'
+export PROMPT_DIRTRIM=3
+export WORKON_HOME=~/.local/share/venv/
export VIRTUAL_ENV_DISABLE_PROMPT=true
export VIRTUALENV_DISTRIBUTE=true
export PIP_RESPECT_VIRTUALENV=true
export PIP_REQUIRE_VIRTUALENV=true
-export PIP_VIRTUALENV_BASE=${WORKON_HOME}
-# pip bash completion start
-_pip_completion()
-{
- COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
- COMP_CWORD=$COMP_CWORD \
- PIP_AUTO_COMPLETE=1 $1 ) )
-}
-complete -o default -F _pip_completion pip
-# pip bash completion end
+export PIP_VIRTUALENV_BASE="${WORKON_HOME}"
+
+export TMPDIR=~/tmp
+( umask 0077
+ tmp=/tmp/user-${USER}/tmp
+ [[ ! -d ${tmp} ]] &&
+ mkdir -p ${tmp}/{dl,misc}
+ [[ ! $(readlink ~/tmp) == ${tmp} ]] &&
+ rm -f ~/tmp &&
+ ln -s ${tmp} ~/tmp
+ ) > /dev/null 2>&1
+
+
+[[ ${TERM} == dumb ]] &&
+ return 0
+
+
+_cache_comp=${ELLIPSIS}var/cache/bash/completions/
+_srcs=(
+ /usr/share/bash-completion/bash_completion
+ /etc/bash_completion
+ /usr/share/git/git-prompt.sh
+ $(type -p virtualenvwrapper.sh)
+ )
+
+mkdir -p "${WORKON_HOME}"
+mkdir -p "${_cache_comp}"
+
+#TODO: impl lazy proxy instead
+for x in $(compgen -c pip); do
+ if [[ ! -e ${_cache_comp}${x} ]]; then
+ (
+ unset PIP_REQUIRE_VIRTUALENV
+ _x=${x//[^[:word:]]}
+ echo "_${_x}_completion()"
+ ${x} completion --bash | sed -n '/^{/,/^}/p'
+ echo "complete -o default -F _${_x}_completion ${x}"
+ ) >> "${_cache_comp}${x}"
+ fi
+ _srcs+=(${_cache_comp}${x})
+done
+
+for x in "${_srcs[@]}"; do
+ [[ -r ${x} ]] &&
+ . ${x}
+done
<<'COMMENT'
@@ -113,12 +135,6 @@ if [[ -z "$SCREEN_COLORS" ]] ; then
fi
-# If any regex matches, we are on a workstation
-export ELLIPSIS_HOSTS+=" .sta.3vera.com"
-
-# Make an array of the above
-read -a __self -r <<<"${ELLIPSIS_HOSTS}"
-
# PS1 special sequences
# 0 reset/default
# 1 bold

0 comments on commit 2baa624

Please sign in to comment.