Skip to content

Instantly share code, notes, and snippets.

@cchamberlain
Last active August 29, 2015 14:25
Show Gist options
  • Save cchamberlain/28a690261e9fc1819641 to your computer and use it in GitHub Desktop.
Save cchamberlain/28a690261e9fc1819641 to your computer and use it in GitHub Desktop.
dot-zshenv
#!/usr/bin/env zsh
#
# Defines Environment Variables
# RESET ZSHENV FILE VIA ENVIRONMENT VARIABLE
export USR_ZSHENV_PATH="$HOME/.zshenv"
if [[ $USR_ZSHENV_RESET -eq 1 ]]; then
unset USR_ZSHENV_RESET
if [[ -z "$GIST_USR_ZSHENV_ID" ]]; then
export GIST_USR_ZSHENV_ID="ad8ae7ce3ef2a965295d"
fi
printf -- "No user zshenv found at $USR_ZSHENV_PATH, using default..."
TEMP_GIST="${TMP:-"$TEMP"}/zshenv"
if [[ -d "$TEMP_GIST" ]]; then
rm -rf "$TEMP_GIST"
fi
git clone https://gist.github.com/$GIST_USR_ZSHENV_ID "$TEMP_GIST"
mv "$USR_ZSHENV_PATH" "$USR_ZSHENV_PATH.bak"
cp "$TEMP_GIST/.zshenv" "$USR_ZSHENV_PATH"
. "$USR_ZSHENV_PATH"
fi
# DIRECTORIES
export ZDOTDIR="${ZDOTDIR:-"$HOME/.zsh"}"
export ZNODEDIR="$ZDOTDIR/node"
export ZSCRIPTDIR="$ZDOTDIR/zsh"
export ZPYTHONDIR="$ZDOTDIR/python"
export ZETCDIR="$ZDOTDIR/etc"
export ZASSETSDIR="$ZDOTDIR/assets"
export ZDOWNLOADDIR="$ZDOTDIR/download"
export ZHELPDIR="$ZDOTDIR/help"
export ZPREZTODIR="$ZDOTDIR/.zprezto"
export ZPERSONALDIR="$HOME/.personal"
# DOTFILES
export ZSHENV_PATH="$ZDOTDIR/.zshenv"
export ZSHRC_PATH="$ZDOTDIR/.zshrc"
export ZPREZTORC_PATH="$ZDOTDIR/.zpreztorc"
export ZPROFILE_PATH="$ZDOTDIR/.zprofile"
export ZLOGIN_PATH="$ZDOTDIR/.zlogin"
export ZLOGOUT_PATH="$ZDOTDIR/.zlogout"
export ZPERSONAL_PATH="$ZPERSONALDIR/.zpersonal"
export NPMRC_PATH="$HOME/.npmrc"
export VIMRC_PATH="$HOME/.vimrc"
# Mac OS X uses path_helper and /etc/paths.d to preload PATH, clear it out first
if [ -x /usr/libexec/path_helper ]; then
PATH=''
eval `/usr/libexec/path_helper -s`
fi
# Get Prezto
if [[ ! -d "$ZPREZTODIR" ]]; then
git clone --recursive https://github.com/$GIT_ZPREZTO_ID "$ZPREZTODIR"
fi
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "$ZPROFILE_PATH" ]]; then
. "$ZPROFILE_PATH"
fi
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Users\\ColeChamberlain\\local\\npm\\node.exe',
1 verbose cli 'C:\\Users\\ColeChamberlain\\local\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'version',
1 verbose cli 'patch' ]
2 info using npm@3.2.0
3 info using node@v0.12.6
4 error version No valid package.json found
5 verbose stack TypeError: Cannot read property 'toString' of undefined
5 verbose stack at stripBOM (C:\Users\ColeChamberlain\cchamberlain\npm\lib\utils\parse-json.js:16:20)
5 verbose stack at module.exports (C:\Users\ColeChamberlain\cchamberlain\npm\lib\utils\parse-json.js:3:21)
5 verbose stack at C:\Users\ColeChamberlain\cchamberlain\npm\lib\version.js:36:14
5 verbose stack at C:\Users\ColeChamberlain\cchamberlain\npm\node_modules\graceful-fs\graceful-fs.js:76:16
5 verbose stack at fs.js:263:20
5 verbose stack at C:\Users\ColeChamberlain\cchamberlain\npm\node_modules\graceful-fs\graceful-fs.js:230:16
5 verbose stack at FSReqWrap.oncomplete (fs.js:95:15)
6 verbose cwd C:\Users\ColeChamberlain\gist\28a690261e9fc1819641
7 error Windows_NT 6.3.9600
8 error argv "C:\\Users\\ColeChamberlain\\local\\npm\\node.exe" "C:\\Users\\ColeChamberlain\\local\\npm\\node_modules\\npm\\bin\\npm-cli.js" "version" "patch"
9 error node v0.12.6
10 error npm v3.2.0
11 error Cannot read property 'toString' of undefined
12 error If you need help, you may report this error at:
12 error <https://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment