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