forked from isen-ng/homebrew-dotnet-sdk-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis-ci.sh
executable file
·46 lines (35 loc) · 1.29 KB
/
travis-ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -u
set -e
any_casks_modified () {
[[ -n "$(modified_cask_files)" ]]
}
modified_cask_files () {
if [[ -z "${MODIFIED_CASK_FILES+defined}" ]]; then
MODIFIED_CASK_FILES="$(git diff --name-only --diff-filter=AM "${TRAVIS_COMMIT_RANGE}" -- Casks/*.rb)"
export MODIFIED_CASK_FILES
fi
echo "${MODIFIED_CASK_FILES}"
}
if any_casks_modified; then
modified_casks=($(modified_cask_files))
echo "Modified casks: ${modified_casks[@]}"
echo "------------------------------------"
if [ "${#modified_casks[@]}" -gt 1 ]; then
echo "More than one cask modified; please submit a pull request for each cask separately."
exit 1
fi
MODIFIED_CASK_FILE=${modified_casks[0]}
echo "Running brew audit $MODIFIED_CASK_FILE ..."
echo "------------------------------------"
brew audit --cask $MODIFIED_CASK_FILE
echo "Running brew style $MODIFIED_CASK_FILE ..."
echo "------------------------------------"
brew style --cask $MODIFIED_CASK_FILE
echo "Running brew install $MODIFIED_CASK_FILE ..."
echo "------------------------------------"
brew install --cask $MODIFIED_CASK_FILE
echo "Running brew zap (uninstall will run implicity) $MODIFIED_CASK_FILE ..."
echo "------------------------------------"
brew uninstall --cask --zap $MODIFIED_CASK_FILE
fi