-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·155 lines (125 loc) · 3.36 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·155 lines (125 loc) · 3.36 KB
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
#!/bin/bash
# Install Homebrew
function install_homebrew
{
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || return 1
}
# Install the latest ruby version
function install_ruby
{
brew install ruby || return 1
}
# Install pod
function install_pod
{
sudo gem install cocoapods || return 1
}
# Install ohmyzsh
function install_ohmyzsh
{
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" || return 1
}
# Custom ohmyzsh
DEV_CONFIGURATION_PATH=/tmp/dev-configuration
function custom_ohmyzsh
{
rm -rf $DEV_CONFIGURATION_PATH
git clone https://github.com/romsi/dev-configuration.git $DEV_CONFIGURATION_PATH
cp -r $DEV_CONFIGURATION_PATH/.zshrc ~/ || return 1
cp -r $DEV_CONFIGURATION_PATH/.custom/themes ~/.oh-my-zsh/custom/ || return 1
cp .oh-my-zsh/custom/themes/agnoster-romsi.zsh-theme .oh-my-zsh/themes || return 1
}
# Install ZSH auto suggestions
ZSH_AUTOSUGGESTIONS_PATH=$ZSH_CUSTOM/plugins/zsh-autosuggestions
function install_zsh_autosuggestions
{
rm -rf $ZSH_AUTOSUGGESTIONS_PATH
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_AUTOSUGGESTIONS_PATH || return 1
}
# Install ZSH syntax highlighting
function install_zsh_syntax_highlighting
{
brew install zsh-syntax-highlighting || return 1
}
# Custom iTerm
function custom_iTerm
{
cp $DEV_CONFIGURATION_PATH/iTerm/fonts/*.ttf /Library/Fonts/
open -a iTerm $DEV_CONFIGURATION_PATH/iTerm/Solarized\ Dark.itermcolors || return 1
echo "Now you should import the custom settings."
}
# Install Mobilette developer tool
DEV_TOOLS_PATH=/tmp/dev-tools
function install_developer_tools
{
rm -rf $DEV_TOOLS_PATH
git clone https://github.com/Mobilette/Developer $DEV_TOOLS_PATH
cd $DEV_TOOLS_PATH
bash $DEV_TOOLS_PATH/developer.sh new ios "Romain Asnar" "romain.asnar@gmail.com"
cd -
}
# Check if a required tool is installed before running the installation
function validate
{
open -Ra "${1}" > /dev/null 2>&1
if [ $? -ne 0 ]; then
return 1
fi
return 0
}
function error
{
echo "${1}"
return 1
}
function print_usage {
echo "[ERROR] Usage: ./install.sh options type [parameters]"
echo ""
echo " --all install all packages"
echo " --ohmyzsh install ohmyzsh package only"
echo " --development install development package only"
echo " --help get more information"
echo ""
}
function install_development_option {
install_homebrew
install_ruby
install_pod
install_developer_tools
}
function install_ohmyzsh_option {
install_homebrew
install_ohmyzsh
custom_ohmyzsh
install_zsh_autosuggestions
install_zsh_syntax_highlighting
source ~/.zshrc
custom_iTerm
}
case "${1}" in
--help )
echo "Help please."
;;
--all )
VALIDATED=true
validate "Xcode" || error "You must install Xcode before running the installation." || VALIDATED=false
validate "iTerm" || error "You must install iTerm before running the installation." || VALIDATED=false
if [ $VALIDATED = false ]; then
exit 1
fi
install_development_option
install_ohmyzsh_option
;;
--ohmyzsh )
validate "iTerm" || error "You must install iTerm before running the installation." || exit 1
install_ohmyzsh_option
;;
--development )
validate "Xcode" || error "You must install iTerm before running the installation." || exit 1
install_development_option
;;
* )
print_usage
exit 1
;;
esac