-
Notifications
You must be signed in to change notification settings - Fork 6
/
mac
executable file
·196 lines (148 loc) · 4.08 KB
/
mac
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/sh
# Welcome to the ISL laptop script!
# Be prepared to turn your laptop (or desktop)
# into a fairly decent development machine.
#
# install OS X developer tools
#
xcode-select -p > /dev/null 2>&1
if [ $? -ne 0 ]
then
xcode-select --install
fi
# fix for pyenv https://github.com/pyenv/pyenv/issues/1219
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
#
# utilities
#
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
append_to_file() {
local file="$1"
local text="$2"
if ! grep -qs "^$text$" "$file"; then
printf "\n%s\n" "$text" >> "$file"
fi
}
create_file() {
local file="$1"
if [ ! -f "$file" ]; then
touch "$file"
fi
}
curl_to_file() {
local file="$1"
local url="$2"
if [ ! -f "$file" ]; then
curl "$url" > "$file"
fi
}
# shellcheck disable=SC2154
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
LAPTOPRC="$HOME/.laptoprc"
create_file "$LAPTOPRC"
brew_install_or_upgrade() {
if brew list | grep "^$1"; then
if brew outdated | grep "^$1 ("; then
fancy_echo "Upgrade $1 ..."
brew upgrade "$@"
else
fancy_echo "Already installed $1 ..."
fi
else
fancy_echo "Installing $1 ..."
brew install "$@"
fi
}
gem_install_or_update() {
if gem list "$1" | grep "^$1 ("; then
fancy_echo "Updating %s ..." "$1"
gem update "$@"
else
fancy_echo "Installing %s ..." "$1"
gem install "$@"
fi
}
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew ..."
curl -fsS \
'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby
# shellcheck disable=SC2016
append_to_file "$LAPTOPRC" 'export PATH="/usr/local/bin:$PATH"'
else
fancy_echo "Homebrew already installed. Skipping ..."
fi
brew update
brew tap 'homebrew/services'
brew tap 'caskroom/cask'
brew tap 'caskroom/versions'
# libs
brew_install_or_upgrade 'libsass'
brew_install_or_upgrade 'libxml2'
brew_install_or_upgrade 'openssl'
brew_install_or_upgrade 'sqlite'
brew_install_or_upgrade 'pkg-config'
# services
brew services stop --all
brew_install_or_upgrade 'elasticsearch'
brew_install_or_upgrade 'mysql'
brew_install_or_upgrade 'postgresql'
brew_install_or_upgrade 'redis'
# languages
brew_install_or_upgrade 'node'
brew_install_or_upgrade 'nvm'
brew_install_or_upgrade 'python'
brew_install_or_upgrade 'pipenv'
brew_install_or_upgrade 'ruby'
brew_install_or_upgrade 'php'
brew_install_or_upgrade 'composer'
# command line utilities
brew_install_or_upgrade 'ack'
brew_install_or_upgrade 'git'
brew_install_or_upgrade 'heroku'
brew_install_or_upgrade 'tree'
brew_install_or_upgrade 'wget'
# casks
brew cask install 'firefox'
brew cask install 'github-desktop'
brew cask install 'google-chrome'
brew cask install 'iterm2'
brew cask install 'transmit'
brew cask install 'tower'
brew cask install 'visual-studio-code'
#
# languages
#
# Python
curl -sf https://gist.githubusercontent.com/jcarbaugh/fd01d825437b735cb44dbac8a11aff1c/raw/2b540829c71c68166c9678cd2ef2d0484e142bde/repython.sh | sh
# Ruby
append_to_file "$HOME/.gemrc" 'gem: --no-document'
fancy_echo 'Updating Rubygems...'
gem update --system
gem_install_or_update 'foreman'
# PHP
# pecl config-get ext_dir
pecl install imagick
pecl install redis
#
# configure VSCode
#
code --install-extension mikestead.dotenv # DotENV
code --install-extension batisteo.vscode-django # Django
code --install-extension EditorConfig.EditorConfig # EditorConfig
code --install-extension dbaeumer.vscode-eslint # ESlint
code --install-extension esbenp.prettier-vscode # Prettier
code --install-extension ms-python.python # Python
code --install-extension robertohuertasm.vscode-icons # vscode-icons'
#
# copy default config files
#
# curl_to_file "$HOME/.editorconfig" \
# "https://raw.githubusercontent.com/istrategylabs/laptop/master/config/editorconfig"
fancy_echo "Finished!"
fancy_echo "Add the following line to the end of .bash_profile or .zshrc:"
fancy_echo "source $LAPTOPRC"