Add text to design contributions
[pixelated-user-agent.git] / osx_setup.sh
1 #!/bin/bash
2
3 # Test to make sure we are OSX
4 if [ $(uname) != 'Darwin' ]
5 then
6     echo "This script should run only on an OSX system!"
7     exit 1
8 fi
9
10 # Read the shell configured for the user and set the variable file accordingly
11 function current_shell {
12     case $SHELL in
13         *bash)
14           echo ~/.bash_profile
15         ;;
16
17         *zsh)
18           echo ~/.zprofile
19         ;;
20
21         /bin/sh)
22           echo ~/.profile
23         ;;
24
25         *)
26             echo "Your shell isn't supported yet!"
27         ;;
28
29         #Other shells can go here
30     esac
31 }
32
33 function install_compass {
34     rbenv install -s 2.2.3
35     eval "$(rbenv init -)"
36     rbenv shell 2.2.3
37     rbenv local 2.2.3
38     gem install compass
39     export PATH=$PATH:~/.rbenv/versions/2.2.3/bin
40     echo "export PATH=$PATH:~/.rbenv/versions/2.2.3/bin" >> $(current_shell)
41     echo 'eval "$(rbenv init -)"' >> $(current_shell)
42 }
43
44 function install_rbenv {
45     hash rbenv 2>/dev/null || brew install rbenv ruby-build
46 }
47
48 function install_npm {
49     hash node 2>/dev/null || brew install npm
50 }
51
52 function clone_repo {
53     if [ -d ./pixelated-user-agent ]
54     then
55       cd pixelated-user-agent
56       /usr/bin/git pull --rebase
57       rm -rf web-ui/node_modules
58     else
59       /usr/bin/git clone https://github.com/pixelated/pixelated-user-agent.git
60       cd pixelated-user-agent
61     fi
62 }
63
64 #setup frontend
65 install_rbenv
66 install_compass
67 install_npm
68
69 #setup backend
70 brew install python # force brew install even if python is already install
71 export  LDFLAGS=-L/usr/local/opt/openssl/lib
72 export  LDFLAGS=-L/usr/local/opt/openssl/lib
73 pip install virtualenv
74
75 # install
76 clone_repo
77 ./install-pixelated.sh -v ~/.virtualenv/user-agent-venv