forked from IcaliaLabs/kaishi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kaishi-mac
143 lines (99 loc) · 3.7 KB
/
kaishi-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
#!/usr/bin/env bash
# This is the kaishi script for setting up your laptop with the
# full stack for web development at Icalia Labs.
set -e
# Shared functions
pretty_print() {
printf "\n%b\n" "$1"
}
pretty_print "Here we go..."
# So it begins
# Oh my zsh installation
pretty_print "Installing oh-my-zsh..."
curl -L http://install.ohmyz.sh | sh
# zsh fix
if [[ -f /etc/zshenv ]]; then
pretty_print "Fixing OSX zsh environment bug ..."
sudo mv /etc/{zshenv,zshrc}
fi
# Homebrew installation
if ! command -v brew &>/dev/null; then
pretty_print "Installing Homebrew, an OSX package manager, follow the instructions..."
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then
pretty_print "Put Homebrew location earlier in PATH ..."
printf '\n# recommended by brew doctor\n' >> ~/.zshrc
printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc
export PATH="/usr/local/bin:$PATH"
fi
else
pretty_print "You already have Homebrew installed...good job!"
fi
pretty_print "Updating brew formulas"
brew update
# Git installation
pretty_print "Installing git for control version"
brew install git
# Posgresql installation
pretty_print "Installing postgresql for database management"
brew install postgresql --no-python
# Vim installation
pretty_print "Installing vim with Homebrew for latest version"
brew install vim
# Image magick installation
pretty_print "Installing image magick for image processing"
brew install imagemagick
pretty_print "Starting postgres..."
brew services start postgres
# Rbenv installation
pretty_print "Rbenv installation for managing your rubies"
brew install rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.zshrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.zshrc
pretty_print "Enable shims and autocompletion ..."
eval "$(rbenv init -)"
fi
export PATH="$HOME/.rbenv/bin:$PATH"
pretty_print "Installing rbenv-gem-rehash, we don't want to rehash everytime we add a gem..."
brew install rbenv-gem-rehash
pretty_print "Installing ruby-build to install Rubies ..."
brew install ruby-build
# OpenSSL linking
pretty_print "Installing and linking OpenSSL..."
brew install openssl
brew link openssl --force
# Install ruby latest version
ruby_version="$(curl -sSL https://raw.githubusercontent.com/IcaliaLabs/kaishi/master/latest_ruby)"
pretty_print "Installing Ruby $ruby_version"
if [ "$ruby_version" = "2.1.1" ]; then
curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1
else
rbenv install "$ruby_version"
fi
pretty_print "Set ruby version $ruby_version as the default"
rbenv global "$ruby_version"
rbenv rehash
pretty_print "Updating gems..."
gem update --system
pretty_print "Setup gemrc for default options"
printf 'gem: --no-document' >> ~/.gemrc
# Bundler installation
pretty_print "Installing bundler..."
gem install bundler
pretty_print "Optimizing Bundler..."
number_of_cores=$(sysctl -n hw.ncpu)
bundle config --global jobs $((number_of_cores - 1))
pretty_print "Installing Foreman..."
gem install foreman
pretty_print "Installing Rails...finally!"
gem install rails
pretty_print "Installing mailcatcher gem...!"
gem install mailcatcher
pretty_print "Installing the heroku toolbelt..."
brew install heroku-toolbelt
pretty_print "Installing custom Rails app generator from Icalia"
curl -L https://raw2.github.com/IcaliaLabs/railsAppCustomGenerator/master/install.sh | sh
pretty_print "Installing pow to serve local rails apps like a superhero..."
curl get.pow.cx | sh
pretty_print "We are done!...everthing looks good!"