]> git.r.bdr.sh - rbdr/lyricli/commitdiff
Add script to install sourcekitten
authorBen Beltran <redacted>
Fri, 19 May 2017 05:36:40 +0000 (00:36 -0500)
committerBen Beltran <redacted>
Fri, 19 May 2017 05:36:40 +0000 (00:36 -0500)
Scripts/install_sourcekitten.sh [new file with mode: 0644]

diff --git a/Scripts/install_sourcekitten.sh b/Scripts/install_sourcekitten.sh
new file mode 100644 (file)
index 0000000..9420a26
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Taken from: https://alexplescan.com/posts/2016/03/03/setting-up-swiftlint-on-travis-ci/
+# And adapted for sourcekitten
+
+# Installs the SourceKitten package.
+# Tries to get the precompiled .pkg file from Github, but if that
+# fails just recompiles from source.
+
+set -e
+
+SOURCEKITTEN_PKG_PATH="/tmp/SourceKitten.pkg"
+SOURCEKITTEN_PKG_URL="https://github.com/jpsim/SourceKitten/releases/download/0.17.3/SourceKitten.pkg"
+
+wget --output-document=$SOURCEKITTEN_PKG_PATH $SOURCEKITTEN_PKG_URL
+
+if [ -f $SOURCEKITTEN_PKG_PATH ]; then
+  echo "SourceKitten package exists! Installing it..."
+  sudo installer -pkg $SOURCEKITTEN_PKG_PATH -target /
+else
+  echo "SourceKitten package doesn't exist. Compiling from source..." &&
+  git clone https://github.com/jspim/SourceKitten.git /tmp/SourceKitten &&
+  cd /tmp/SourceKitten &&
+  sudo make install
+fi