Last active
October 9, 2018 00:01
-
-
Save brennanMKE/52de412600bfa9d0596c6bd9a10d6381 to your computer and use it in GitHub Desktop.
SwiftLint script which requires a base version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BASE_VERSION=0.26.0 | |
SWIFT_LINT_CMD=`which swiftlint` | |
function version_gt() { test $(printf '%s\n' "$@" | sort --version-sort | head -n 1) != "${1}"; } | |
if [ ! -f "${SWIFT_LINT_CMD}" ]; then | |
echo "warning: SwiftLint not installed. Please install using brew. See: https://github.com/realm/SwiftLint" | |
else | |
SWIFT_LINT_VERSION=`"${SWIFT_LINT_CMD}" version` | |
if version_gt ${SWIFT_LINT_VERSION} ${BASE_VERSION}; then | |
"${SWIFT_LINT_CMD}" --quiet | |
else | |
echo "warning: SwiftLint requires a newer version. Please upgrade using brew. See: https://github.com/realm/SwiftLint" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment