forked from insidegui/WWDC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·52 lines (42 loc) · 1.37 KB
/
bootstrap.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
#!/bin/bash
if [[ ${CI} ]]; then
echo -en '\033[33;1mBootstrap\033[0m travis_fold:start:bootstrap\\r'
fi
echo ""
./teamid.sh
lessThanOrEqual() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
lessThan() {
[ "$1" = "$2" ] && return 1 || lessThanOrEqual $1 $2
}
SWIFTLINT_MIN="0.27"
SWIFTLINT_INSTALLED=$([ `command -v swiftlint` ] && echo true || echo false )
BREW_INSTALLED=$([ `command -v brew` ] && echo true || echo false )
SWIFTLINT_UPDATED=false
if $SWIFTLINT_INSTALLED; then
if ! lessThan `swiftlint version` $SWIFTLINT_MIN; then
SWIFTLINT_UPDATED=true
fi
fi
if ! $SWIFTLINT_INSTALLED || ! $SWIFTLINT_UPDATED; then
echo "WWDC for macOS uses SwiftLint ${SWIFTLINT_MIN} or above to ensure a consistent codestyle. SwiftLint is either not installed or does not meet this minimum version."
if $BREW_INSTALLED; then
read -p "Use Homebrew to globally install the latest version of SwiftLint? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
if $SWIFTLINT_INSTALLED; then
brew upgrade swiftlint
else
brew install swiftlint
fi
else
echo 'Please install SwiftLint & try again to continue.'
exit 1
fi
else
echo 'Please install SwiftLint & try again to continue.'
exit 1
fi
fi
echo "All done"