Update setup script, make do_the_brew bash compatible.

This commit is contained in:
2014-08-25 19:10:05 -07:00
parent 202b217520
commit b165c4c4ac
8 changed files with 174 additions and 150 deletions

View File

@@ -1,11 +1,13 @@
function brew_install_items() {
echo $@
for package_install_string in $@;
do
# Horrible hack to induce word splitting.
eval "package_args=($package_install_string)"
package_args=$package_install_string
if is_zsh;
then
# Horrible hack to induce word splitting.
eval "package_args=($package_install_string)"
fi
brew install $package_args;
brew link $package_args[1];
done
}
@@ -18,68 +20,67 @@ function fix_brew_htop() {
function do_the_brew() {
ESSENTIAL=(
"emacs"
"git"
"tmux"
"python --with-brewed-openssl"
"htop"
"greadlink"
"vim --override-system-vi"
"zsh"
"make"
"emacs" \
"tmux" \
"python --with-brewed-openssl" \
"htop" \
"greadlink" \
"vim --override-system-vi" \
"zsh" \
"make" \
)
# `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
# core utilities (those that come with OS X are outdated)
BASICS=(
"findutils"
"coreutils"
"binutils"
"diffutils"
"ed --default-names"
"gawk"
"gnu-indent --default-names"
"gnu-sed --default-names"
"gnu-tar --default-names"
"gnu-which --default-names"
"gnutls --default-names"
"grep --default-names"
"gzip"
"watch"
"wdiff --with-gettext"
"wget --enable-iri"
"findutils" \
"coreutils" \
"binutils" \
"diffutils" \
"ed --default-names" \
"gawk" \
"gnu-indent --default-names" \
"gnu-sed --default-names" \
"gnu-tar --default-names" \
"gnu-which --default-names" \
"gnutls --default-names" \
"grep --default-names" \
"gzip" \
"watch" \
"wdiff --with-gettext" \
"wget --enable-iri" \
)
SHOULD_INSTALL=(
"nmap"
"readline"
"netcat"
"reattach-to-user-namespace"
"daemonize"
"ngrep"
"gist"
"gawk"
"pstree"
"ack"
"hub"
"tig"
"heroku"
"scala"
"sbt"
"node"
"npm"
"nmap" \
"readline" \
"netcat" \
"reattach-to-user-namespace" \
"daemonize" \
"ngrep" \
"gist" \
"gawk" \
"pstree" \
"ack" \
"hub" \
"tig" \
"heroku" \
"scala" \
"sbt" \
"node" \
"npm" \
)
MISC=(
"file-formula"
"git"
"less"
"openssh --with-brewed-openssl"
"perl518"
"rsync"
"svn"
"unzip"
"macvim --override-system-vim --custom-system-icons"
MISC=("file-formula" \
"less" \
"openssh --with-brewed-openssl" \
"perl518" \
"rsync" \
"svn" \
"unzip" \
"macvim --override-system-vim --custom-system-icons" \
)
install_items=()
OPTIND=1
echo "${MISC[@]}"
while getopts "uebsmah" OPTCHAR;
do
case $OPTCHAR in
@@ -103,7 +104,20 @@ function do_the_brew() {
install_items=("${install_items[@]}" "${ESSENTIAL[@]}" "${BASICS[@]}" "${SHOULD_INSTALL[@]}" "${MISC[@]}")
;;
h)
echo "Usage:
do_the_brew_help
return
;;
esac
done
echo "Installing the following packages:"
for package_name in "${install_items[@]}"; do echo $package_name; done;
brew update
brew_install_items $install_items
brew cleanup
}
function do_the_brew_help() {
echo "do_the_brew Usage:
-a install all packages.
-u upgrade brew packages.
-e install essential packages
@@ -112,12 +126,4 @@ function do_the_brew() {
-m install very non-essential packages.
-h display this help message.
"
return
esac
done
echo "Installing:"
for package_name in $install_items; do echo $package_name; done;
brew update
brew_install_items $install_items
brew cleanup
}

View File

@@ -1,2 +1,2 @@
local dircolors_file="$HOME/.dircolors"
dircolors_file="$HOME/.dircolors"
test -r $dircolors_files && eval "$(dircolors $dircolors_file)"

View File

@@ -1,9 +1,3 @@
function dotfiles_abspath() {
readlink_command='readlink'
command -v greadlink > /dev/null && readlink_command="greadlink"
echo "$(${readlink_command} -f "$BASH_SOURCE" | xargs dirname | xargs dirname)"
}
function go2dotfiles() {
cd $(dirname `readlink -f ~/.zshrc | xargs dirname`)
}
@@ -42,6 +36,7 @@ function confirm() {
function get_cols() {
FS=' '
OPTIND=1
while getopts "F:" OPTCHAR; do
case $OPTCHAR in
F)
@@ -129,6 +124,7 @@ function git_root() {
function git_diff_replacing() {
local original_sha='HEAD~1'
local new_sha='HEAD'
OPTIND=1
while getopts "do:n:" OPTCHAR;
do
case $OPTCHAR in
@@ -154,6 +150,7 @@ function git_diff_replacing() {
function git_reset_author() {
local should_update_command=''
local update_command=''
OPTIND=1
while getopts "a:e:A:E:h" OPTCHAR;
do
case $OPTCHAR in

View File

@@ -1,17 +1,16 @@
ESSENTIAL=(ipdb ipython virtualenv)
FOR_EDITOR=(jedi pyflakes)
USEFUL=(
Flask
ddg
ouimeaux
readline
simplejson
tox
numpy
)
function install_python_packages() {
sudo pip install $ESSENTIAL
ESSENTIAL=(ipdb ipython virtualenv)
FOR_EDITOR=(jedi pyflakes)
USEFUL=(
Flask
ddg
ouimeaux
readline
simplejson
tox
numpy
)
OPTIND=1
while getopts "uea" OPTCHAR;
do
case $OPTCHAR in
@@ -24,8 +23,18 @@ function install_python_packages() {
a)
sudo pip install $FOR_EDITOR
sudo pip install $USEFUL
install_pygame
install_powerline
;;
h)
echo "
-u Install useful but non essential python.
-e Install editor python packages.
-a Install all python utilities."
;;
esac
done
sudo pip install $ESSENTIAL
}
function install_pygame() {

View File

@@ -1,5 +1,6 @@
function make_me_synergy() {
local new_host_name="$(echo $SSH_CONNECTION | get_cols 1)"
OPTIND=1
while getopts "h:" OPTCHAR; do
case $OPTCHAR in
h)

View File

@@ -5,6 +5,6 @@ done
alias srczsh="source ~/.zshrc"
# Online help.
unalias run-help
unalias run-help 2> /dev/null 1>/dev/null
autoload run-help
HELPDIR=/usr/local/share/zsh/helpfiles