Change indentation from 4 for to 2 spaces in shell scripts

This commit is contained in:
2012-04-21 20:25:29 +01:00
parent 9822615e79
commit d2ea935228
9 changed files with 86 additions and 86 deletions

View File

@@ -9,7 +9,7 @@ DOTFILES_LINK=".dotfiles"
SYMLINK_PATH="$DOTFILES_LINK" SYMLINK_PATH="$DOTFILES_LINK"
PRIVATE_PATH="private" PRIVATE_PATH="private"
SYMLINKS=(bundle emacs.d erlang gemrc gitconfig gitignore hgrc irbrc \ SYMLINKS=(bundle emacs.d erlang gemrc gitconfig gitignore hgrc irbrc \
powconfig rspec tmux.conf) powconfig rspec tmux.conf tmuxifier)
LOAD_FILES=(profile zprofile) LOAD_FILES=(profile zprofile)
# #
@@ -17,39 +17,39 @@ LOAD_FILES=(profile zprofile)
# #
install_symlinks () { install_symlinks () {
# Symlink dotfiles root # Symlink dotfiles root
symlink "$ROOT_PATH" "$TARGET/$DOTFILES_LINK" symlink "$ROOT_PATH" "$TARGET/$DOTFILES_LINK"
# Setup private dotfiles # Setup private dotfiles
if [ -f "$ROOT_PATH/$PRIVATE_PATH/install.sh" ]; then if [ -f "$ROOT_PATH/$PRIVATE_PATH/install.sh" ]; then
"$ROOT_PATH/$PRIVATE_PATH/install.sh" links "$ROOT_PATH/$PRIVATE_PATH/install.sh" links
fi fi
# Symlink each path # Symlink each path
for i in ${SYMLINKS[@]}; do for i in ${SYMLINKS[@]}; do
symlink "$SYMLINK_PATH/$i" "$TARGET/.$i" symlink "$SYMLINK_PATH/$i" "$TARGET/.$i"
done done
# Symlink shell init file for bash and zsh # Symlink shell init file for bash and zsh
for i in ${LOAD_FILES[@]}; do for i in ${LOAD_FILES[@]}; do
symlink "$DOTFILES_LINK/load_shellrc.sh" "$TARGET/.$i" symlink "$DOTFILES_LINK/load_shellrc.sh" "$TARGET/.$i"
done done
} }
install_homebrew () { install_homebrew () {
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
} }
install_rbenv () { install_rbenv () {
git_clone 'git://github.com/sstephenson/rbenv.git' "$TARGET/.rbenv" git_clone 'git://github.com/sstephenson/rbenv.git' "$TARGET/.rbenv"
} }
install_nvm () { install_nvm () {
git_clone 'https://github.com/creationix/nvm.git' "$TARGET/.nvm" git_clone 'https://github.com/creationix/nvm.git' "$TARGET/.nvm"
} }
install_virtualenv () { install_virtualenv () {
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | bash curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | bash
} }
@@ -58,12 +58,12 @@ install_virtualenv () {
# #
if [ -n "${BASH_SOURCE[0]}" ] && [ -f "${BASH_SOURCE[0]}" ] ; then if [ -n "${BASH_SOURCE[0]}" ] && [ -f "${BASH_SOURCE[0]}" ] ; then
ROOT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
elif [ -n "$0" ] && [ -f "$0" ]; then elif [ -n "$0" ] && [ -f "$0" ]; then
ROOT_PATH=$(cd "$(dirname "$0")" && pwd) ROOT_PATH=$(cd "$(dirname "$0")" && pwd)
else else
echo "[ERROR] Can't determine dotfiles' root path." echo "[ERROR] Can't determine dotfiles' root path."
exit 1 exit 1
fi fi
@@ -72,20 +72,20 @@ fi
# #
symlink() { symlink() {
if [ ! -e "$2" ]; then if [ ! -e "$2" ]; then
echo " symlink: $2 --> $1" echo " symlink: $2 --> $1"
ln -s "$1" "$2" ln -s "$1" "$2"
else else
echo " exists: $2" echo " exists: $2"
fi fi
} }
git_clone () { git_clone () {
if [ ! -e "$2" ]; then if [ ! -e "$2" ]; then
git clone "$1" "$2" git clone "$1" "$2"
else else
echo "[ERROR] $2 already exists" echo "[ERROR] $2 already exists"
fi fi
} }
@@ -94,36 +94,36 @@ git_clone () {
# #
case "$1" in case "$1" in
symlinks|links) symlinks|links)
install_symlinks install_symlinks
;; ;;
homebrew|brew) homebrew|brew)
install_homebrew install_homebrew
;; ;;
rbenv) rbenv)
install_rbenv install_rbenv
;; ;;
nvm) nvm)
install_nvm install_nvm
;; ;;
virtualenv|venv) virtualenv|venv)
install_virtualenv install_virtualenv
;; ;;
info) info)
echo "Target directory: $TARGET" echo "Target directory: $TARGET"
echo "Detected dotfiles root: $ROOT_PATH" echo "Detected dotfiles root: $ROOT_PATH"
;; ;;
*) *)
echo 'usage: ./install.sh [command]' echo 'usage: ./install.sh [command]'
echo '' echo ''
echo 'Available commands:' echo 'Available commands:'
echo ' info: Target and source directory info.' echo ' info: Target and source directory info.'
echo ' symlinks: Install symlinks for various dotfiles into' \ echo ' symlinks: Install symlinks for various dotfiles into' \
'target directory.' 'target directory.'
echo ' homebrew: Install Homebrew (Mac OS X only).' echo ' homebrew: Install Homebrew (Mac OS X only).'
echo ' rbenv: Install rbenv, a Ruby version manager.' echo ' rbenv: Install rbenv, a Ruby version manager.'
echo ' nvm: Install nvm, a Node.js version manager.' echo ' nvm: Install nvm, a Node.js version manager.'
echo ' virtualenv: Install virtualenv-burrito, a Python version and' \ echo ' virtualenv: Install virtualenv-burrito, a Python version and' \
'environment manager.' 'environment manager.'
;; ;;
esac esac

View File

@@ -13,9 +13,9 @@ path_prepend "/usr/local/bin"
# Load bash or zsh specific init files # Load bash or zsh specific init files
if [ -n "$BASH_VERSION" ]; then if [ -n "$BASH_VERSION" ]; then
source "$DOTSHELL/bashrc.sh" source "$DOTSHELL/bashrc.sh"
elif [ -n "$ZSH_VERSION" ]; then elif [ -n "$ZSH_VERSION" ]; then
source "$DOTSHELL/zshrc.sh" source "$DOTSHELL/zshrc.sh"
fi fi
# Aliases # Aliases
@@ -62,6 +62,6 @@ path_prepend "./vendor/bundle/bin" # Ruby Bundler
# Ensure TMPDIR is the same for local and remote ssh logins # Ensure TMPDIR is the same for local and remote ssh logins
if [[ $TMPDIR == "/var/folders/"* ]] || [[ $TMPDIR == "" ]]; then if [[ $TMPDIR == "/var/folders/"* ]] || [[ $TMPDIR == "" ]]; then
export TMPDIR="/tmp/user-$USER" export TMPDIR="/tmp/user-$USER"
mkdir -p "$TMPDIR" mkdir -p "$TMPDIR"
fi fi

View File

@@ -3,8 +3,8 @@
# #
if [ -f "/Applications/Emacs.app/Contents/MacOS/Emacs" ]; then if [ -f "/Applications/Emacs.app/Contents/MacOS/Emacs" ]; then
alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw" alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
fi fi
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
alias emacsclient="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" alias emacsclient="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
fi fi

View File

@@ -21,11 +21,11 @@ alias gx="gitx"
# Git Completion # Git Completion
if [ -f "/usr/local/etc/bash_completion.d/git-completion.bash" ]; then if [ -f "/usr/local/etc/bash_completion.d/git-completion.bash" ]; then
source "/usr/local/etc/bash_completion.d/git-completion.bash" source "/usr/local/etc/bash_completion.d/git-completion.bash"
fi fi
# Only needed for Bash. Zsh is much smarter with it's auto-completion ^_^ # Only needed for Bash. Zsh is much smarter with it's auto-completion ^_^
if [ -n "$BASH_VERSION" ]; then if [ -n "$BASH_VERSION" ]; then
complete -o default -o nospace -F _git g complete -o default -o nospace -F _git g
complete -o default -o nospace -F _git gi complete -o default -o nospace -F _git gi
fi fi

View File

@@ -4,5 +4,5 @@
# Load nvm if it's available # Load nvm if it's available
if [ -f "$HOME/.nvm/nvm.sh" ]; then if [ -f "$HOME/.nvm/nvm.sh" ]; then
source "$HOME/.nvm/nvm.sh" source "$HOME/.nvm/nvm.sh"
fi fi

View File

@@ -4,5 +4,5 @@
# Load virtualenv-burrito if it's available # Load virtualenv-burrito if it's available
if [ -f "$HOME/.venvburrito/startup.sh" ]; then if [ -f "$HOME/.venvburrito/startup.sh" ]; then
source "$HOME/.venvburrito/startup.sh" source "$HOME/.venvburrito/startup.sh"
fi fi

View File

@@ -22,8 +22,8 @@ alias va="bundle exec vagrant"
# Load rbenv or RVM depending on which is available # Load rbenv or RVM depending on which is available
if [ -d "$HOME/.rbenv/bin" ]; then if [ -d "$HOME/.rbenv/bin" ]; then
export PATH="$HOME/.rbenv/bin:$PATH" export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)" eval "$(rbenv init -)"
elif [ -s "$HOME/.rvm/scripts/rvm" ]; then elif [ -s "$HOME/.rvm/scripts/rvm" ]; then
source "$HOME/.rvm/scripts/rvm" source "$HOME/.rvm/scripts/rvm"
fi fi

View File

@@ -6,5 +6,5 @@ alias tml="tm ls"
# Tmux Completion # Tmux Completion
if [ -f "/usr/local/etc/bash_completion.d/tmux" ]; then if [ -f "/usr/local/etc/bash_completion.d/tmux" ]; then
source "/usr/local/etc/bash_completion.d/tmux" source "/usr/local/etc/bash_completion.d/tmux"
fi fi

View File

@@ -4,21 +4,21 @@
# Set path to root of dotfiles # Set path to root of dotfiles
if [ -n "${BASH_SOURCE[0]}" ] && [ -f "${BASH_SOURCE[0]}" ] ; then if [ -n "${BASH_SOURCE[0]}" ] && [ -f "${BASH_SOURCE[0]}" ] ; then
DOTFILES="`dirname \"${BASH_SOURCE[0]}\"`" DOTFILES="`dirname \"${BASH_SOURCE[0]}\"`"
elif [ -n "$0" ] && [ -f "$0" ]; then elif [ -n "$0" ] && [ -f "$0" ]; then
DOTFILES="`dirname \"$0\"`" DOTFILES="`dirname \"$0\"`"
elif [ -d "$HOME/.dotfiles" ]; then elif [ -d "$HOME/.dotfiles" ]; then
DOTFILES="$HOME/.dotfiles" DOTFILES="$HOME/.dotfiles"
fi fi
# Load main dotfiles # Load main dotfiles
DOTSHELL="$DOTFILES/shell" DOTSHELL="$DOTFILES/shell"
if [ -f "$DOTSHELL/_main.sh" ]; then if [ -f "$DOTSHELL/_main.sh" ]; then
source "$DOTSHELL/_main.sh" source "$DOTSHELL/_main.sh"
fi fi
# Setup and load private dotfiles # Setup and load private dotfiles
DOTPFILES="$DOTFILES/private" DOTPFILES="$DOTFILES/private"
if [ -f "$DOTPFILES/shellrc.sh" ]; then if [ -f "$DOTPFILES/shellrc.sh" ]; then
source "$DOTPFILES/shellrc.sh" source "$DOTPFILES/shellrc.sh"
fi fi