install_swiftlint.sh 732 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # Installs the SwiftLint package.
  3. # Tries to get the precompiled .pkg file from Github, but if that
  4. # fails just recompiles from source.
  5. set -e
  6. SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg"
  7. SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.18.1/SwiftLint.pkg"
  8. wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL
  9. if [ -f $SWIFTLINT_PKG_PATH ]; then
  10. echo "SwiftLint package exists! Installing it..."
  11. sudo installer -pkg $SWIFTLINT_PKG_PATH -target /
  12. else
  13. echo "SwiftLint package doesn't exist. Compiling from source..." &&
  14. git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint &&
  15. cd /tmp/SwiftLint &&
  16. git submodule update --init --recursive &&
  17. sudo make install
  18. fi