-
Notifications
You must be signed in to change notification settings - Fork 17
/
project_setup.sh
executable file
·80 lines (66 loc) · 1.46 KB
/
project_setup.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
#!/bin/bash
# Checks if executable exists in current path
command_exists () {
command -v "$1" > /dev/null 2>&1;
}
echo "iOS project setup ..."
# Check if user only wants to run unit tests
only_test=false
[ "$1" == "only_test" ] && only_test=true
# Check if user wants to create build envirnoment
# and execute the unit tests
with_test=false
[ "$1" == "with_test" ] && with_test=true
# Run fastlane unit tests
unit_test() {
fastlane test
}
if $only_test
then
unit_test
exit 0
fi
# Check if Ruby is installed
if ! command_exists ruby
then
echo 'Ruby not found, please install it:'
echo 'https://www.ruby-lang.org/en/downloads/'
exit 1
fi
# Check if Homebrew is available
if ! command_exists brew
then
echo 'Homebrew not found, please install it:'
echo 'https://brew.sh/'
exit 1
else
echo "Update Homebrew ..."
brew update
fi
# Install Bundler Gem
if ! command_exists bundle
then
echo "Bundler not found, installing it ..."
gem install bundler -v '~> 1.16.2'
else
echo "Update Bundler"
gem update bundler '~> 1.16.2'
fi
# Install Ruby Gems
echo "Install Ruby Gems ..."
bundle install
# Install Cocopods dependencies
echo "Install Cocoapods"
pod install
# Install Carthage
echo "Install / Update carthage ..."
brew unlink carthage || true
brew install carthage
brew link --overwrite carthage
# Install Carthage dependencies
echo "Install Carthage Dependencies ..."
carthage bootstrap --platform ios --cache-builds
if $with_test
then
unit_test
fi