-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall_fest.sh
executable file
·167 lines (137 loc) · 3.87 KB
/
install_fest.sh
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
#!/bin/bash
set -e
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
install_mac_tools() {
# Do we have to install mac tools?
XCODE=`xcode-select --version | grep -i 'not found' || true`
if [[ $? -eq 1 ]]; then
`xcode-select --install`
else
echo "xcode already installed"
return
fi
}
install_homebrew() {
echo "Installing Homebrew..."
sudo ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
}
update_homebrew() {
echo "Updating Homebrew..."
brew update
echo "...done"
}
brew_install_git() {
echo "Installing git..."
brew install git
config_git
echo "...done"
}
update_rubygems() {
echo "Updating rubygems to latest version..."
gem update --system
echo "...done"
}
install_bundler() {
echo "Installing bundler..."
gem install bundler
echo "...done"
}
install_ruby() {
echo "Installing Ruby..."
curl -L https://get.rvm.io | bash -s stable --ruby
source $HOME/.rvm/scripts/rvm
rvm use 2.1.0 --default
echo "...done"
}
install_rails() {
echo "Installing rails..."
gem install -v 4.0.4 rails
echo "...done"
}
install_sublime_text_mac() {
echo "Downloading and installing SublimeText"
cd /tmp && curl http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.dmg -O
sudo hdiutil attach /tmp/Sublime\ Text\ 2.0.2.dmg
sudo installer -pkg /Volumes/Sublime\ Text\ 2.0.2/Sublime\ Text\ 2.0.2.pkg -target /Applications
sudo hdiutil detach /tmp/Sublime\ Text\ 2.0.2.dmg
echo "...done"
subl_to_path .bash_profile
}
install_sublime_text_linux() {
echo "Downloading and installing SublimeText"
cd /tmp && wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.tar.bz2
tar xjvf /tmp/Sublime\ Text\ 2.0.2.tar.bz2 -C $HOME/ga/lib
echo "...done"
subl_to_path .bashrc
}
subl_to_path() {
echo "Adding Sublime Text to your PATH..."
mv ~/ga/lib/Sublime\ Text\ 2/ ~/ga/lib/sublime_text
mv ~/ga/lib/sublime_text/sublime_text ~/ga/lib/sublime_text/subl
echo "PATH=$PATH:$HOME/ga/lib/sublime_text" >> ~/$1
echo "...done"
}
check_install() {
echo "Installation is complete. Check that everything works:"
echo " 1. Open a new command line (don't use this one)."
echo " 2. Type 'rvm -v'"
echo " - you should see version 1.0.0 or higher"
echo " 3. Type 'ruby -v'"
echo " - you should see version 2.0.0"
echo " 4. Type 'rails -v'"
echo " - you should see version 4.0.0"
echo " 5. Type 'git config -l'"
echo " - you should see your username and email in the output"
echo " 6. Type 'subl foo'"
echo " - Sublime Text editor should open up"
echo ""
echo "If everything worked then you are set for BEWD! Go forth and program!"
}
config_git() {
echo "What is your GitHub username? (If you don't have one, now's a great time to come up with one!)"
read username
git config --global user.name "$username"
echo "What is your GitHub email?" email
read email
git config --global user.email "$email"
echo "OK, I've set up your git config"
}
OS=`lowercase \`uname\``
GA_LIB="$HOME/ga/lib"
echo "creating a directory for ga tools at ~/ga/lib"
mkdir -p $GA_LIB
if [[ $OS == "darwin" ]]; then
echo "Mac OS X.. An aristocrat, eh?"
install_mac_tools
install_ruby
update_rubygems
install_homebrew
update_homebrew
brew_install_git
install_bundler
install_rails
install_sublime_text_mac
check_install
elif [[ $OS == "linux" ]]; then
echo "Ah, classy operating system!"
echo "Updating system..."
sudo apt-get update
echo "...done"
echo "Installing curl..."
sudo apt-get install -y curl
echo "...done"
install_ruby
echo "Installing git..."
sudo apt-get install -y build-essential git-core
config_git
echo "...done"
update_rubygems
install_bundler
install_rails
install_sublime_text_linux
source $HOME/.bashrc
check_install
echo "You are set for BEWD! Go forth and program!"
fi