Permalink
Browse files

use ~/.dotto_local instead of ~/.dotto/local, and

~/.dotto_local/externals instead of ~/.dotto/external
  • Loading branch information...
1 parent 437ef33 commit d9733a3cca4c9d4fa001f5a9fcc57cd155d2995c @rsanders committed Feb 15, 2012
View
@@ -1 +0,0 @@
-*
View
@@ -1,2 +0,0 @@
-*
-
@@ -17,10 +17,12 @@ function work_in_dir {
}
-[[ -z $DOTTODIR || ! -d $DOTTODIR/external ]] && { echo "Dotto not installed"; exit 1 }
+[[ -z $DOTTODIR || ! -d $DOTTO_LOCAL ]] && { echo "Dotto not installed"; exit 1 }
+
+mkdir -p $DOTTO_EXTERNALS
name=${1:-$USERNAME}
-dir=$DOTTODIR/external/$name
+dir=$DOTTO_EXTERNALS/$name
[[ -d $dir ]] && { echo "$dir already exists"; exit 1 }
View
@@ -40,9 +40,12 @@ function zrealpath() {
}
-DOTTODIR=$(zrealpath ${0:h}/..)
+: ${DOTTODIR:=$(zrealpath ${0:h}/..)}
+: ${DOTTO_LOCAL:=$HOME/.dotto_local}
+: ${DOTTO_EXTERNALS:=$DOTTO_LOCAL/externals}
ZCONFIGDIR=$DOTTODIR/zsh
+mkdir -p $DOTTO_LOCAL
dobackup=1
if egrep 'DOTTODIR' $HOME/.zprofile >/dev/null 2>&1; then
@@ -51,7 +54,7 @@ else
dozbackup=1
fi
-backupbase=$DOTTODIR/local/backup
+backupbase=$DOTTO_LOCAL/backup
zbackupdir=$backupbase/`hostname`
dotbackupdir=$zbackupdir/conf.d
@@ -88,7 +91,7 @@ done
typeset -A installed_dotfiles
-for zfile in $DOTTODIR/external/*/conf.d/*(N) $DOTTODIR/conf.d/*(N); do
+for zfile in $DOTTO_EXTERNALS/*/conf.d/*(N) $DOTTODIR/conf.d/*(N); do
basefile=`basename $zfile`
dotfile=.$basefile
install=1
View
@@ -30,6 +30,12 @@ function () {
dotto_vars[os_version]=$2
dotto_vars[arch]=$3
+ typeset -g DOTTO_EXTERNALS
+ typeset -g DOTTO_LOCAL
+
+ : ${DOTTO_LOCAL:=$HOME/.dotto_local}
+ : ${DOTTO_EXTERNALS:=$DOTTO_LOCAL/externals}
+
# various useful bits and well-known configuration vars
typeset -g ZSH_THEME ZSH_CUSTOM
@@ -66,15 +72,15 @@ function () {
fi
# add precompiled bundles to fpath
- fpath=($newfpaths $ZCONFIGDIR/functions $ZCONFIGDIR/completions $DOTTODIR/local/build/zsh/$ZSH_VERSION/**/*.zwc(N.) $fpath)
+ fpath=($newfpaths $ZCONFIGDIR/functions $ZCONFIGDIR/completions $DOTTO_LOCAL/build/zsh/$ZSH_VERSION/**/*.zwc(N.) $fpath)
zctrace 'FPATH is $fpath'
# add external bundle bin
- path+=($DOTTODIR/external/*/bin(N) $DOTTODIR/external/*/bin/`uname`(N) $path)
+ path+=($DOTTO_EXTERNALS/*/bin(N) $DOTTO_EXTERNALS/*/bin/`uname`(N) $path)
zctrace 'PATH is $fpath'
typeset -a funcpaths
- funcpaths=("$ZCONFIGDIR/functions/*(.N)" "$DOTTODIR/external/*/zsh/functions/*(.N)")
+ funcpaths=("$ZCONFIGDIR/functions/*(.N)" "$DOTTO_EXTERNALS/*/zsh/functions/*(.N)")
set -A funcpaths ${~funcpaths}
zctrace 'funcpaths is $fpath'
@@ -96,33 +102,39 @@ function () {
## load paths for lib and plugin dirs
# setup our lib paths
- dotto_zsh_lib_paths+=($DOTTODIR/local/zsh/lib(/N) $DOTTODIR/external/*/zsh/lib(/N) \
+ dotto_zsh_lib_paths+=($DOTTO_LOCAL/zsh/lib(/N) $DOTTO_EXTERNALS/*/zsh/lib(/N) \
$ZCONFIGDIR/lib(/N))
# just some pointers to fings
dotto_paths[HOME]=$DOTTODIR
dotto_paths[ZCONFIGDIR]=$ZCONFIGDIR
- dotto_paths[BUILD_DIR]=$DOTTODIR/local/build/zsh/$ZSH_VERSION
- dotto_paths[CACHE_DIR]=$DOTTODIR/local/cache
+ dotto_paths[BUILD_DIR]=$DOTTO_LOCAL/build/zsh/$ZSH_VERSION
+ dotto_paths[CACHE_DIR]=$DOTTO_LOCAL/cache
# setup our plugin roots
- dotto_zsh_plugin_roots+=($DOTTODIR/local/zsh/plugins(/N) $DOTTODIR/external/*/zsh/plugins(/N) \
+ dotto_zsh_plugin_roots+=($DOTTO_LOCAL/zsh/plugins(/N) \
+ $DOTTO_EXTERNALS/*/zsh/plugins(/N) \
$ZCONFIGDIR/plugins(/N))
## load default prefs and local prefs - do this here so that the
## prefs can overwrite the config variables above
zrunsystem prefs
- for zcfile in $DOTTODIR/prefs(N) \
- $DOTTODIR/zsh/prefs(N) \
- $DOTTODIR/external/*/prefs(.N) \
- $DOTTODIR/external/*/zsh/prefs(.N) \
- $DOTTODIR/external/*/users/$USERNAME/zsh/prefs(.N) \
- $DOTTODIR/local/prefs(N) \
- $DOTTODIR/local/zsh/prefs(N) \
+ typeset -A statres
+ dotto_vars[prefs_mtime]=0
+ zmodload zsh/stat
+ for zcfile in $DOTTO_EXTERNALS/*/prefs(.N) \
+ $DOTTO_EXTERNALS/*/zsh/prefs(.N) \
+ $DOTTO_EXTERNALS/*/users/$USERNAME/zsh/prefs(.N) \
+ $DOTTO_LOCAL/prefs(N) \
+ $DOTTO_LOCAL/zsh/prefs(N) \
$HOME/.zshprefs(N)
do
+ builtin stat +mtime -H statres $zcfile
+ if [[ $statres[mtime] -gt $dotto_vars[prefs_mtime] ]]; then
+ dotto_vars[prefs_mtime]=$statres[mtime]
+ fi
source $zcfile
done
@@ -141,9 +153,9 @@ function () {
zrunsystem zshenv
for file in $ZCONFIGDIR/zshenv.d/*(.N) \
- $DOTTODIR/external/*/zsh/zshenv.d/*(.N) \
- $DOTTODIR/external/*/zsh/zshenv.d/`uname`/*(.N) \
- $DOTTODIR/external/*/hosts/{$SHORTHOST,$HOST}/zsh/zshenv.d/*(.N)
+ $DOTTO_EXTERNALS/*/zsh/zshenv.d/*(.N) \
+ $DOTTO_EXTERNALS/*/zsh/zshenv.d/`uname`/*(.N) \
+ $DOTTO_EXTERNALS/*/hosts/{$SHORTHOST,$HOST}/zsh/zshenv.d/*(.N)
do
[[ ${file:e} == (disabled|example) ]] && continue
source $file
View
@@ -18,7 +18,7 @@ function _zloadlib {
local libdir=$1 lib=$2 zwc="" func=""
- for zwc in $DOTTODIR/local/build/zsh/${ZSH_VERSION}/lib/$lib/**/*.zwc(N.); do
+ for zwc in $DOTTO_LOCAL/build/zsh/${ZSH_VERSION}/lib/$lib/**/*.zwc(N.); do
fpath+=($zwc)
done
View
@@ -20,7 +20,7 @@ function _zrunsystem_setup {
zsystem_paths=()
zsystem_roots=($ZCONFIGDIR)
- for droot in $DOTTODIR/external/*(N); do
+ for droot in $DOTTO_EXTERNALS/*(N); do
[[ -d $droot/zsh ]] && zsystem_roots+=${droot}/zsh
[[ -d $droot ]] && zsystem_roots+=${droot}
done
View
@@ -15,9 +15,9 @@
source "$DOTTODIR/$arg"
zlog "zsource: sourcing dottodir/$arg"
fi
- if [[ -f "$DOTTODIR/local/zsh/$arg" ]]; then
- source "$DOTTODIR/local/zsh/$arg"
- zlog "zsource: sourcing dottodir/local/zsh/$arg"
+ if [[ -f "$DOTTO_LOCAL/zsh/$arg" ]]; then
+ source "$DOTTO_LOCAL/zsh/$arg"
+ zlog "zsource: sourcing DOTTO_LOCAL/zsh/$arg"
fi
done
@@ -4,7 +4,7 @@
function _zmultiroot {
local droot dir
for dir in "${(@)*}"; do
- for droot in $ZCONFIGDIR $DOTTODIR/external/*/zsh $DOTTODIR/local/zsh; do
+ for droot in $ZCONFIGDIR $DOTTO_EXTERNALS/*/zsh $DOTTO_LOCAL/zsh; do
[[ -n "$droot" ]] && droot="${droot%/}/"
zctrace "checking ${droot}${dir}"
[[ -d "${droot}${dir}" ]] && zsystemrootdirs+="${droot}${dir}"
@@ -3,8 +3,8 @@
typeset -g PATH
typeset -g -a path
-[ -d "$DOTTODIR/external/autojump" ] && source "$DOTTODIR/external/autojump/autojump.zsh"
+[ -d "$DOTTO_EXTERNALS/autojump" ] && source "$DOTTO_EXTERNALS/autojump/autojump.zsh"
-if [ -z ${path[(r)$DOTTODIR/external/autojump]} ]; then
- path+=($DOTTODIR/external/autojump)
+if [ -z ${path[(r)$DOTTO_EXTERNALS/autojump]} ]; then
+ path+=($DOTTO_EXTERNALS/autojump)
fi
@@ -1,3 +1,3 @@
-FPATH=$DOTTODIR/local/build/zsh/${ZSH_VERSION}/lib/vcs_info.zwc:`dirname $0`/functions:$FPATH
+FPATH=$DOTTO_LOCAL/build/zsh/${ZSH_VERSION}/lib/vcs_info.zwc:`dirname $0`/functions:$FPATH
autoload -Uz vcs_info
@@ -5,7 +5,7 @@
# git clone git://github.com/ndbroadbent/scm_breeze.git ~/dotto/external/scm_breeze
#
-[ -s "$DOTTODIR/external/scm_breeze/scm_breeze.sh" ] && source "$DOTTODIR/external/scm_breeze/scm_breeze.sh"
+[ -s "$DOTTO_EXTERNALS/scm_breeze/scm_breeze.sh" ] && source "$DOTTO_EXTERNALS/scm_breeze/scm_breeze.sh"
compdef hub=git
dotto~compinit

0 comments on commit d9733a3

Please sign in to comment.