Improve install scripts, refactor structors and overall modularity
This commit is contained in:
parent
6bcb3ab91e
commit
d2aaea6009
8
bashrc
Normal file
8
bashrc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Source component rcfiles
|
||||||
|
source ~/.zsh/functions
|
||||||
|
source ~/.zsh/paths
|
||||||
|
|
||||||
|
export -f echoh
|
||||||
|
|
||||||
|
# Load RVM into a shell session *as a function*
|
||||||
|
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
|
12
bin/update
12
bin/update
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
echo "* Updating Mac OS"
|
|
||||||
sudo softwareupdate -i -a
|
|
||||||
|
|
||||||
src=$(cd "$(dirname "$0")"; pwd)
|
|
||||||
|
|
||||||
$src/../install/brew
|
|
||||||
$src/../install/rvm
|
|
||||||
$src/../install/vim
|
|
||||||
|
|
||||||
echo "\nAll done!"
|
|
24
install.sh
24
install.sh
|
@ -1,22 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
src=$(cd "$(dirname "$0")"; pwd)
|
GREEN=$(tput setaf 2)
|
||||||
|
RS=$(tput sgr0)
|
||||||
|
|
||||||
|
src=$(cd "$(dirname "$0")"; pwd)
|
||||||
if [ ! -d $src/install ]; then
|
if [ ! -d $src/install ]; then
|
||||||
echo
|
echo -e "$GREEN==> Cloning dotfiles repo"
|
||||||
echo "* Cloning dotfiles repo"
|
git clone https://github.com/hlissner/dotfiles.git ~/.dotfiles | sed "s/^/ /"
|
||||||
git clone https://github.com/hlissner/dotfiles.git ~/.dotfiles
|
|
||||||
src="~/.dotfiles"
|
src="~/.dotfiles"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$src/install/osx
|
{
|
||||||
$src/install/zsh
|
$src/install/osx
|
||||||
$src/install/brew
|
$src/install/zsh
|
||||||
$src/install/git
|
$src/install/brew
|
||||||
$src/install/rvm
|
$src/install/git
|
||||||
$src/install/tmux
|
$src/install/rvm
|
||||||
|
$src/install/tmux
|
||||||
|
} | sed "s/^/ /"
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
echo "And if you want to install vim, run:"
|
echo "And if you want to install vim, run:"
|
||||||
echo " sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)"
|
echo " sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)"
|
||||||
|
|
79
install/brew
79
install/brew
|
@ -1,57 +1,48 @@
|
||||||
#!/bin/bash
|
#!/bin/zsh
|
||||||
|
|
||||||
echo "[HOMEBREW]"
|
if ! command-exists brew ; then
|
||||||
if [ ! `command -v "brew"` ]; then
|
echoh "==> Homebrew: Installing"
|
||||||
echo
|
|
||||||
echo "* Installing homebrew"
|
|
||||||
# http://mxcl.github.com/homebrew/
|
# http://mxcl.github.com/homebrew/
|
||||||
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
|
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) | indent
|
||||||
|
|
||||||
echo
|
echoh "==> Homebrew: Installing essential brews"
|
||||||
echo "* Setting up homebrew"
|
{
|
||||||
# Install GNU core utilities (those that come with OS X are outdated)
|
# Install GNU core utilities (those that come with OS X are outdated)
|
||||||
brew install coreutils
|
brew install coreutils
|
||||||
# echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
|
# echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
|
||||||
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
|
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
|
||||||
brew install findutils
|
brew install findutils
|
||||||
# Install Bash 4
|
# Install Bash 4
|
||||||
brew install bash
|
brew install bash
|
||||||
|
|
||||||
# Install wget with IRI support
|
# Install wget with IRI support
|
||||||
brew install wget --enable-iri
|
brew install wget --enable-iri
|
||||||
|
|
||||||
# Install more recent versions of some OS X tools
|
# Install more recent versions of some OS X tools
|
||||||
brew tap homebrew/dupes
|
brew tap homebrew/dupes
|
||||||
brew install homebrew/dupes/grep
|
brew install homebrew/dupes/grep
|
||||||
brew tap josegonzalez/homebrew-php
|
brew tap josegonzalez/homebrew-php
|
||||||
|
|
||||||
# Install everything else
|
# Install everything else
|
||||||
brew install ack
|
brew install ack git rename tree python ruby node nginx memcached ctags macvim
|
||||||
brew install git
|
brew install php54 --with-fpm --with-imap --with-mysql --with-pgsql --without-apache
|
||||||
brew install rename
|
brew install php54-imagick php54-mcrypt php54-xdebug readline
|
||||||
brew install tree
|
} | indent
|
||||||
|
|
||||||
# vim
|
|
||||||
brew install python ruby
|
|
||||||
brew install node nginx memcached ctags
|
|
||||||
brew install php54 --with-fpm --with-imap --with-mysql --with-pgsql --without-apache
|
|
||||||
brew install php54-imagick php54-mcrypt php54-xdebug readline
|
|
||||||
brew install php54-intl
|
|
||||||
brew install macvim
|
|
||||||
else
|
else
|
||||||
echo
|
echoh "==> Homebrew: Updating"
|
||||||
echo "* Updating homebrew"
|
{
|
||||||
# Make sure we’re using the latest Homebrew
|
# Make sure we’re using the latest Homebrew
|
||||||
brew update
|
brew update
|
||||||
|
|
||||||
# Upgrade any already-installed formulae
|
# Upgrade any already-installed formulae
|
||||||
brew upgrade
|
brew upgrade
|
||||||
|
} | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Homebrew: Cleaning up"
|
||||||
echo "* Cleaning up homebrew"
|
|
||||||
# Remove outdated versions from the cellar
|
# Remove outdated versions from the cellar
|
||||||
brew cleanup
|
brew cleanup | indent
|
||||||
|
|
||||||
echo
|
echoh "==> Homebrew: DONE!"
|
||||||
echo "Done!"
|
|
||||||
|
|
24
install/git
24
install/git
|
@ -1,33 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/zsh
|
||||||
|
|
||||||
echo "[GIT]"
|
if ! command-exists git; then
|
||||||
|
if ! command-exists brew; then
|
||||||
if [ ! `command -v "git"` ]; then
|
|
||||||
if [ ! `command -v "brew"` ]; then
|
|
||||||
echo "Homebrew is required!"
|
echo "Homebrew is required!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Git: Installing"
|
||||||
echo "* Installing git"
|
brew install git | indent
|
||||||
brew install git
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /usr/local/bin/branch ]; then
|
if [ ! -e /usr/local/bin/branch ]; then
|
||||||
echo
|
echoh "==> Git: Installing git-friendly"
|
||||||
echo "* Installing git-friendly"
|
|
||||||
|
|
||||||
# https://github.com/jamiew/git-friendly
|
# https://github.com/jamiew/git-friendly
|
||||||
bash < <(curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
|
bash < <(curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create links
|
# Create links
|
||||||
echo
|
echoh "==> Git: Setting up symlinks"
|
||||||
echo "* Setting up symlinks"
|
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
|
||||||
|
|
||||||
|
src=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
ln -sf $src/gitignore ~/.gitignore
|
ln -sf $src/gitignore ~/.gitignore
|
||||||
ln -sf $src/gitconfig ~/.gitconfig
|
ln -sf $src/gitconfig ~/.gitconfig
|
||||||
|
|
||||||
echo
|
echoh "==> Git: DONE!"
|
||||||
echo "Done!"
|
|
||||||
|
|
63
install/rvm
63
install/rvm
|
@ -1,51 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/zsh
|
||||||
|
|
||||||
echo "[RVM]"
|
if ! command-exists "rvm"; then
|
||||||
|
|
||||||
if [ ! `command -v "rvm"` ]; then
|
|
||||||
# If RVM's not installed, install it and the rubies
|
# If RVM's not installed, install it and the rubies
|
||||||
echo
|
echoh "==> Rvm: Installing"
|
||||||
echo "* Installing RVM"
|
|
||||||
|
|
||||||
# https://rvm.io
|
# https://rvm.io
|
||||||
curl -L https://get.rvm.io | bash -s stable --ruby
|
curl -L https://get.rvm.io | bash -s stable --ruby | indent
|
||||||
|
|
||||||
echo
|
echoh "==> Rvm: Install rubies"
|
||||||
echo "* Install rubies"
|
{
|
||||||
|
# Install rubies and update rubygems
|
||||||
|
rvm install 1.9.3
|
||||||
|
rvm install 1.8.7-p371
|
||||||
|
|
||||||
# Install rubies and update rubygems
|
# But ultimately, the system should be the default
|
||||||
rvm install 1.9.3
|
rvm --default use system
|
||||||
rvm install 1.8.7-p371
|
|
||||||
|
|
||||||
# But ultimately, the system should be the default
|
# A few prerequisites
|
||||||
rvm --default use system
|
sudo gem install bluecloth capistrano bundler
|
||||||
|
} | indent
|
||||||
|
|
||||||
# A few prerequisites
|
|
||||||
sudo gem install bluecloth capistrano bundler
|
|
||||||
else
|
else
|
||||||
# Otherwise, update it
|
# Otherwise, update it
|
||||||
|
|
||||||
# Make sure rvm is sourced properly
|
# Make sure rvm is sourced properly
|
||||||
if [ -f ~/.rvm/scripts/rvm ]; then
|
if [ -f ~/.rvm/scripts/rvm ]; then
|
||||||
[[ "$(type rvm)" =~ "function$" ]] || source ~/.rvm/scripts/rvm
|
[ "$(type rvm | grep function)" ] || source ~/.rvm/scripts/rvm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update all rubies and rubygems
|
# Update all rubies and rubygems
|
||||||
for v in 1.9.3 1.8.7; do
|
for v in 1.9.3 1.8.7; do
|
||||||
echo
|
echoh "==> Rvm: Updating ruby $v"
|
||||||
echo "* Updating ruby $v"
|
{
|
||||||
rvm use $v
|
rvm use $v
|
||||||
gem update --system
|
gem update --system
|
||||||
gem update
|
gem update
|
||||||
done
|
} | indent
|
||||||
|
done
|
||||||
|
|
||||||
# Update system ruby
|
# Update system ruby
|
||||||
echo
|
echoh "==> Rvm: Updating system ruby"
|
||||||
echo "* Updating system ruby"
|
{
|
||||||
rvm use system
|
rvm use system
|
||||||
sudo gem update --system
|
sudo gem update --system
|
||||||
sudo gem update
|
sudo gem update
|
||||||
|
} | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Rvm: DONE!"
|
||||||
echo "Done!"
|
|
||||||
|
|
18
install/tmux
18
install/tmux
|
@ -1,21 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/zsh
|
||||||
|
|
||||||
echo "[TMUX]"
|
if ! command-exists brew; then
|
||||||
if [ ! `command -v "brew"` ]; then
|
|
||||||
echo "Requires homebrew"
|
echo "Requires homebrew"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
|
||||||
if [ ! `command -v "tmux"` ]; then
|
if [ ! `command -v "tmux"` ]; then
|
||||||
echo "* Installing tmux & reattach-to-user-namespace"
|
echoh "==> Tmux: Installing tmux & reattach-to-user-namespace"
|
||||||
brew install tmux reattach-to-user-namespace libevent
|
brew install tmux reattach-to-user-namespace libevent | indent
|
||||||
else
|
else
|
||||||
echo "* Tmux is already installed!"
|
echoh "==> Tmux: already installed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Tmux: Setting up symlinks"
|
||||||
echo "* Setting up symlinks"
|
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
src=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
|
|
||||||
ln -sf $src/tmux.conf ~/.tmux.conf
|
ln -sf $src/tmux.conf ~/.tmux.conf
|
||||||
|
|
||||||
|
echoh "==> Tmux: DONE!"
|
||||||
|
|
39
install/vim
39
install/vim
|
@ -1,37 +1,40 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
if [ ! `command -v "brew"` ]; then
|
source $(cd "$(dirname "$0")/.."; pwd)/zshrc
|
||||||
|
|
||||||
|
if ! command-exists "brew"; then
|
||||||
echo "Homebrew is required!"
|
echo "Homebrew is required!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! `command -v "mvim"` ]; then
|
if ! command-exists "mvim"; then
|
||||||
echo
|
echoh "==> Vim: Installing macvim"
|
||||||
echo "* Installing macvim"
|
brew install macvim --with-cscope --override-system-vim | indent
|
||||||
brew install macvim --with-cscope --override-system-vim
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e ~/.vimrc ]; then
|
if [ ! -e ~/.vimrc ]; then
|
||||||
echo
|
echoh "==> Vim: Installing vim rcfiles"
|
||||||
echo "* Installing vim rcfiles"
|
|
||||||
|
|
||||||
if [ -d ~/.vim ]; then
|
if [ -d ~/.vim ]; then
|
||||||
rm -rf ~/.vim
|
rm -rf ~/.vim
|
||||||
fi
|
fi
|
||||||
sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)
|
sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L) | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Vim: Updating..."
|
||||||
echo "* Updating vim..."
|
{
|
||||||
vim +BundleInstall! +BundleClean! +q +q
|
find ~/.vim/bundle/ -type d -name .git \
|
||||||
|
| xargs -n 1 dirname \
|
||||||
|
| while read line; do cd $line && echo -n "$(basename $line): " && git pull; done
|
||||||
|
} | indent
|
||||||
|
|
||||||
if [ -d ~/.vim/bundle/YouCompleteMe ] && [ ! -e ~/.vim/bundle/YouCompleteMe/python/ycm_core.so ]; then
|
if [ -d ~/.vim/bundle/YouCompleteMe ] && [ ! -e ~/.vim/bundle/YouCompleteMe/python/ycm_core.so ]; then
|
||||||
echo
|
echoh "==> Vim: Trying to compile YCM"
|
||||||
echo "* Trying to compile YCM"
|
{
|
||||||
brew install cmake
|
brew install cmake
|
||||||
cd ~/.vim/bundle/YouCompleteMe
|
cd ~/.vim/bundle/YouCompleteMe
|
||||||
./install.sh --clang-completer
|
./install.sh --clang-completer
|
||||||
|
} | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echoh "==> Vim: DONE!"
|
||||||
echo "Done!"
|
|
||||||
|
|
23
install/zsh
23
install/zsh
|
@ -1,26 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "[ZSH]"
|
echoh() {
|
||||||
|
echo -e "\033[01;38;5;2m$1\033[39m"
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -d ~/.oh-my-zsh ]; then
|
if [ ! -d ~/.oh-my-zsh ]; then
|
||||||
# https://github.com/robbyrussell/oh-my-zsh
|
# https://github.com/robbyrussell/oh-my-zsh
|
||||||
echo
|
echoh "==> ZSH: Installing oh-my-zsh"
|
||||||
echo "* Installing oh-my-zsh"
|
|
||||||
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
|
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
|
||||||
|
|
||||||
# Set new shell
|
# Set new shell
|
||||||
echo
|
echoh "==> ZSH: Changing shell"
|
||||||
echo "* Changing shell"
|
|
||||||
chsh -s /bin/zsh
|
chsh -s /bin/zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create links
|
# Create links
|
||||||
echo
|
echoh "==> ZSH: Setting up symlinks"
|
||||||
echo "* Setting up symlinks"
|
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
src=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
|
[ -d ~/.zsh ] && rm ~/.zsh
|
||||||
ln -sf $src/zshrc ~/.zshrc
|
|
||||||
ln -sf $src/zsh ~/.zsh
|
ln -sf $src/zsh ~/.zsh
|
||||||
|
ln -sf $src/zshrc ~/.zshrc
|
||||||
|
ln -sf $src/zshenv ~/.zshenv
|
||||||
|
ln -sf $src/bashrc ~/.bashrc
|
||||||
|
|
||||||
echo
|
echoh "==> ZSH: DONE!"
|
||||||
echo "Done!"
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# Aliases #
|
# Aliases #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
|
alias ls='ls -G'
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
alias la='ls -la'
|
alias la='ls -la'
|
||||||
alias l.='ls -Ad .*'
|
alias l.='ls -Ad .*'
|
||||||
|
|
|
@ -1,10 +1,53 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
function command_exists() {
|
SRC=$(cd "$(dirname "$0")"; pwd)
|
||||||
|
|
||||||
|
function command-exists {
|
||||||
command -v "$1" &> /dev/null
|
command -v "$1" &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Open a file in Mac OS's quick-look
|
# Open a file in Mac OS's quick-look
|
||||||
function quick-look() {
|
function quick-look {
|
||||||
(( $# > 0 )) && qlmanage -p $* &>/dev/null &
|
(( $# > 0 )) && qlmanage -p $* &>/dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function echoh {
|
||||||
|
echo -e "\e[0;01m\e[0;32m$1\e[00m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function indent {
|
||||||
|
sed 's/^/ /'
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract {
|
||||||
|
if [ -f $1 ] ; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xjf $1 ;;
|
||||||
|
*.tar.gz) tar xzf $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) unrar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xf $1 ;;
|
||||||
|
*.tbz2) tar xjf $1 ;;
|
||||||
|
*.tgz) tar xzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1 ;;
|
||||||
|
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function update {
|
||||||
|
echoh "Updating EVERYTHING!"
|
||||||
|
{
|
||||||
|
$SRC/../install/brew
|
||||||
|
echo
|
||||||
|
$SRC/../install/rvm
|
||||||
|
echo
|
||||||
|
$SRC/../install/vim
|
||||||
|
} | indent
|
||||||
|
|
||||||
|
echoh "All done!"
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ if [ -d ~/Dropbox ]; then
|
||||||
PATH=~/Dropbox/dev/bin:$PATH
|
PATH=~/Dropbox/dev/bin:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command_exists brew; then
|
if command-exists brew; then
|
||||||
BREWDIR=`brew --prefix`
|
BREWDIR=`brew --prefix`
|
||||||
|
|
||||||
PATH=$BREWDIR/sbin:$PATH
|
PATH=$BREWDIR/sbin:$PATH
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
prompt_pwd() {
|
prompt_pwd() {
|
||||||
SHORTPWD=`print -Pn "%4~"`
|
SHORTPWD=`print -Pn "%4~"`
|
||||||
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
||||||
|
|
2
zshrc
2
zshrc
|
@ -4,8 +4,6 @@ plugins=(laravel ruby python brew)
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# Source component rcfiles
|
# Source component rcfiles
|
||||||
source ~/.zsh/functions
|
|
||||||
source ~/.zsh/paths
|
|
||||||
source ~/.zsh/aliases
|
source ~/.zsh/aliases
|
||||||
source ~/.zsh/config
|
source ~/.zsh/config
|
||||||
source ~/.zsh/completion
|
source ~/.zsh/completion
|
||||||
|
|
Loading…
Reference in a new issue