-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·146 lines (118 loc) · 3.04 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env bash
# Variables
green='\033[1;32m'
yellow='\033[1;33m'
blue='\033[1;34m'
nocolor='\033[0m'
dotfiles=`find . -type f -name ".*" -maxdepth 1`
dotfiledirs=`find . -maxdepth 1 -type d -not -iwholename "*.git" -not -wholename "."`
homedir=${HOME}"/"
dir=$(pwd)
# Functions
function ascii() {
echo -e "${blue}${@}${nocolor}"
}
function log() {
echo -e "\n${green}${@}${nocolor}"
}
function info() {
echo -e "${blue}${@}${nocolor}"
}
function warning() {
echo -e "\n⇏ ${yellow}${@}${nocolor}"
}
function brewski() {
info " ├─ Brewing ${@}"
brew install "${@}"
}
# Start Magic
if test ! $(which brew); then
log "Installing Brew ✈ ✈ ✈"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
warning "Brew already installed"
fi
log "Updating Brew ..."
brew update
brew upgrade
log "Installing Brew Binaries ..."
brewski ack
brewski diff-so-fancy
brewski git
brewski git-extras
brewski n
brewski ncdu
brewski wget
brewski go
brewski ack
brewski gradle
brewski postgresql
brewski redis
log "Install Node Latest and Stable"
n latest
n stable
log "Cleanup Brew ..."
brew cleanup
log "Installing Global NPM Packages ..."
npm install grunt-cli eslint eslint-plugin-react db-migrate pkgcount nodemon depcheck http-server mocha -g
log "Linking Sublime Text CLI"
if test ! $(which subl); then
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin
else
warning "Sublime Text CLI already installed"
fi
log "Checking for ZSH ..."
if [ -d ~/.oh-my-zsh ]; then
warning "You already have Oh My Zsh installed."
else
log "Installing ZSH ..."
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
chsh -s `which zsh`
/usr/bin/env zsh
fi
log "Adding zsh_local for overrides"
if [ ! -e ~/.zsh_local ]; then
touch ~/.zsh_local
fi
log "Copying [dot]files|dirs ..."
mkdir -p ~/dotfiles_old
for file in $dotfiles; do
file=${file//.\/}
# Skip if it's already a symlink
if ! [ -L $homedir$file ]; then
if [ -f $homedir$file ]; then
warning "Backup $file ~ to ~/dotfiles_old"
mv ~/$file ~/dotfiles_old/
fi
info " ├─ Linking $file to ~"
ln -s $dir/$file ~/$file
fi
done
for dotdir in $dotfiledirs; do
dotdir=${dotdir//.\/}
# Skip if it's already a symlink
if ! [ -d $homedir$dotdir ]; then
if [ -f $homedir$dotdir ]; then
warning "Backup $dir ~ to ~/dotfiles_old"
mv ~/$dotdir ~/dotfiles_old/
fi
info " ├─ Linking $dotdir to ~"
ln -s $dir/$dotdir ~/$dotdir
fi
done
ascii "
______ _______ __ _ _______
| | | || | | || |
| _ || _ || |_| || ___|
| | | || | | || || |___
| |_| || |_| || _ || ___|
| || || | | || |___
|______| |_______||_| |__||_______|
"
# Remove functions
unset log
unset info
unset warning
unset installcask
unset brewski
unset ascii