-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·63 lines (54 loc) · 1.64 KB
/
setup
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
#!/usr/bin/env bash
setup_enviroment() {
clear
echo "******* Setup Project *******"
echo ""
validate_xcode_version
install_system_basics
install_brew_dependencies
install_carthage_dependencies
open_project
}
validate_xcode_version() {
echo "Validating Xcode version..."
xcode_version=$(xcodebuild -version|grep -e '\d\.\d' -o)
minimum_version=9.4
if (( $(echo "$xcode_version < $minimum_version" | bc -l) )); then
echo -e "\033[31mYou must have/select Xcode 9.4.0+"
echo "Try: sudo xcode-select -s /Applications/Xcode[Version].app"
echo "Or download and install Xcode above $minimum_version"
exit 1
fi
}
install_system_basics() {
echo "Setup system basics..."
if ! type "brew" &> /dev/null; then
echo "Installing brew..."
eval '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'
fi
}
install_brew_dependencies() {
echo "Setup brew packages..."
brew_dependencies=(carthage swiftlint imagemagick)
for brew_dependency in "${brew_dependencies[@]}"; do
if ! brew ls --versions ${brew_dependency} > /dev/null; then
echo "Installing $brew_dependency..."
brew install $brew_dependency
fi
done
}
install_carthage_dependencies() {
echo "Setup carthage..."
carthage bootstrap --platform iOS
}
open_project() {
while true; do
read -p "Open project on Xcode? [y/n] " yn
case $yn in
[Yy]* ) open MovieBox.xcodeproj; break;;
[Nn]* ) exit;;
* ) echo "Please answer Yes or No.";;
esac
done
}
setup_enviroment