Skip to content

Commit

Permalink
Update .zprofile .zshenv .zshrc
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo committed Aug 27, 2013
1 parent 8549aee commit 11194ce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .zprofile
@@ -1,4 +1,4 @@
if which keychain > /dev/null; then
if type keychain > /dev/null; then
keychain ~/.ssh/github_key
source ~/.keychain/$HOST-sh
fi
Expand Down
46 changes: 18 additions & 28 deletions .zshenv
Expand Up @@ -2,52 +2,42 @@ export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
export PATH="$HOME/bin:$PATH"

function source_if_exists() { [[ -f $1 ]] && source $1 }
function export_path_if_exists { [[ -d "$1" ]] && export PATH="$1:$PATH" }
function source_if_exists { [[ -f "$1" ]] && source "$1" }

source_if_exists ~/dotfiles/zsh/antigen/antigen.zsh

antigen-bundle rbenv
antigen-bundle bundler

if [ -d /usr/local/share/npm/bin ]; then
export PATH="/usr/local/share/npm/bin:$PATH"
export_path_if_exists "$HOME/.plenv/bin" && eval "$(plenv init -)"
export_path_if_exists "$HOME/mysql-build/bin"
export_path_if_exists /usr/local/share/git-core/contrib/workdir
export_path_if_exists /usr/local/share/npm/bin && {
export NODE_PATH="/usr/local/share/npm/lib/node_modules"
fi

if [ -d "$HOME/.plenv/bin" ]; then
export PATH="$HOME/.plenv/bin:$PATH"
eval "$(plenv init -)"
fi

if [ -d "$HOME/mysql-build/bin" ]; then
export PATH="$HOME/mysql-build/bin:$PATH"
fi

if [ -d "$(brew --prefix coreutils)/libexec/gnubin" ]; then
export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
fi

if [ -x /usr/libexec/java_home ]; then
export JAVA_HOME="$(/usr/libexec/java_home)"
export PATH="$JAVA_HOME/bin:$PATH"
fi
}

if [ -d /usr/local/lib/pkgconfig ]; then
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
fi

if which hub > /dev/null; then
if type hub > /dev/null; then
eval "$(hub alias -s zsh)"
fi

if [ xDarwin = x`uname` ]; then
export CONFIGURE_OPTS="--with-opt-dir=/usr/local"
if [ "Darwin" = "$(uname)" ]; then
if [ -x /usr/libexec/java_home ]; then
export JAVA_HOME="$(/usr/libexec/java_home)"
export_path_if_exists "$JAVA_HOME/bin"
fi

export_path_if_exists "$(brew --prefix coreutils)/libexec/gnubin"

export CFLAGS=-Wno-error=shorten-64-to-32
export RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`"
fi

export EDITOR='vim'
export PAGER='less -R'

export PERL_CPANM_OPT='-nq'
export RBXOPT=-X19

disable r
20 changes: 12 additions & 8 deletions .zshrc
Expand Up @@ -75,7 +75,7 @@ alias -g A='| awk'
alias -g X='| xargs'
alias -g J='| jq'

if which dstat > /dev/null; then
if type dstat > /dev/null; then
alias dstat-full='dstat -Tclmdrn'
alias dstat-mem='dstat -Tclm'
alias dstat-cpu='dstat -Tclr'
Expand All @@ -94,21 +94,25 @@ if [ xLinux = x`uname` ]; then
fi

function static_httpd {
if which plackup > /dev/null; then
if type plackup > /dev/null; then
plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root => ".")->to_app'
elif which ruby > /dev/null; then
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port => 5000, :DocumentRoot => ".").start'
elif which python > /dev/null; then
elif type ruby > /dev/null; then
if ruby -v | grep -qm1 'ruby 2\.'; then
ruby -run -e httpd -- --port=5000 .
else
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port => 5000, :DocumentRoot => ".").start'
fi
elif type python > /dev/null; then
if python -V 2>&1 | grep -qm1 'Python 3\.'; then
python -m http.server 5000
else
python -m SimpleHTTPServer 5000
fi
elif which node > /dev/null; then
elif type node > /dev/null; then
node -e "var c=require('connect'), d=process.env.PWD; c().use(c.logger()).use(c.static(d)).use(c.directory(d)).listen(5000);"
elif which php > /dev/null && php -v | grep -qm1 'PHP 5\.[45]\.'; then
elif type php > /dev/null && php -v | grep -qm1 'PHP 5\.[45]\.'; then
php -S 0.0.0.0:5000
elif which erl > /dev/null; then
elif type erl > /dev/null; then
erl -eval 'inets:start(), inets:start(httpd, [{server_name, "httpd"}, {server_root, "."}, {document_root, "."}, {port, 5000}])'
fi
}
Expand Down

0 comments on commit 11194ce

Please sign in to comment.