Skip to content

Commit

Permalink
always git pull on login shell; improve pip handling; correct exports
Browse files Browse the repository at this point in the history
  • Loading branch information
C Anthony Risinger committed Sep 23, 2012
1 parent e31a3be commit 2baa624
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 58 deletions.
2 changes: 2 additions & 0 deletions .../config
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@
# ellipsis defines
[alias "ellipsis"]
init = !${GIT_DIR}/self/bin/ellipsis init
[merge]
defaultToUpstream = true
38 changes: 15 additions & 23 deletions .../self/data/profile/boot/bash
Original file line number Diff line number Diff line change
@@ -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
86 changes: 51 additions & 35 deletions .../self/data/profile/etc/bash/interactive
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2baa624

Please sign in to comment.