]> git.r.bdr.sh - rbdr/lyricli/blob - Scripts/install_swiftlint.sh
6a2f250f8ba5c2e2d3ed5e5ce180baed313c5732
[rbdr/lyricli] / Scripts / install_swiftlint.sh
1 #!/bin/bash
2
3 # Taken from: https://alexplescan.com/posts/2016/03/03/setting-up-swiftlint-on-travis-ci/
4
5 # Installs the SwiftLint package.
6 # Tries to get the precompiled .pkg file from Github, but if that
7 # fails just recompiles from source.
8
9 set -e
10
11 SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg"
12 SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.18.1/SwiftLint.pkg"
13
14 wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL
15
16 if [ -f $SWIFTLINT_PKG_PATH ]; then
17 echo "SwiftLint package exists! Installing it..."
18 sudo installer -pkg $SWIFTLINT_PKG_PATH -target /
19 else
20 echo "SwiftLint package doesn't exist. Compiling from source..." &&
21 git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint &&
22 cd /tmp/SwiftLint &&
23 git submodule update --init --recursive &&
24 sudo make install
25 fi