diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/changelog-links.sh | 31 | ||||
-rwxr-xr-x | scripts/errcheck.sh | 24 | ||||
-rwxr-xr-x | scripts/gofmtcheck.sh | 13 | ||||
-rwxr-xr-x | scripts/gogetcookie.sh | 10 |
4 files changed, 78 insertions, 0 deletions
diff --git a/scripts/changelog-links.sh b/scripts/changelog-links.sh new file mode 100755 index 0000000..401e440 --- /dev/null +++ b/scripts/changelog-links.sh | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to | ||
4 | # be Markdown links to the given github issues. | ||
5 | # | ||
6 | # This is run during releases so that the issue references in all of the | ||
7 | # released items are presented as clickable links, but we can just use the | ||
8 | # easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section | ||
9 | # while merging things between releases. | ||
10 | |||
11 | set -e | ||
12 | |||
13 | if [[ ! -f CHANGELOG.md ]]; then | ||
14 | echo "ERROR: CHANGELOG.md not found in pwd." | ||
15 | echo "Please run this from the root of the terraform provider repository" | ||
16 | exit 1 | ||
17 | fi | ||
18 | |||
19 | if [[ `uname` == "Darwin" ]]; then | ||
20 | echo "Using BSD sed" | ||
21 | SED="sed -i.bak -E -e" | ||
22 | else | ||
23 | echo "Using GNU sed" | ||
24 | SED="sed -i.bak -r -e" | ||
25 | fi | ||
26 | |||
27 | PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-statuscake" | ||
28 | |||
29 | $SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md | ||
30 | |||
31 | rm CHANGELOG.md.bak | ||
diff --git a/scripts/errcheck.sh b/scripts/errcheck.sh new file mode 100755 index 0000000..15464f5 --- /dev/null +++ b/scripts/errcheck.sh | |||
@@ -0,0 +1,24 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # Check gofmt | ||
4 | echo "==> Checking for unchecked errors..." | ||
5 | |||
6 | if ! which errcheck > /dev/null; then | ||
7 | echo "==> Installing errcheck..." | ||
8 | go get -u github.com/kisielk/errcheck | ||
9 | fi | ||
10 | |||
11 | err_files=$(errcheck -ignoretests \ | ||
12 | -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \ | ||
13 | -ignore 'bytes:.*' \ | ||
14 | -ignore 'io:Close|Write' \ | ||
15 | $(go list ./...| grep -v /vendor/)) | ||
16 | |||
17 | if [[ -n ${err_files} ]]; then | ||
18 | echo 'Unchecked errors found in the following places:' | ||
19 | echo "${err_files}" | ||
20 | echo "Please handle returned errors. You can check directly with \`make errcheck\`" | ||
21 | exit 1 | ||
22 | fi | ||
23 | |||
24 | exit 0 | ||
diff --git a/scripts/gofmtcheck.sh b/scripts/gofmtcheck.sh new file mode 100755 index 0000000..1c05581 --- /dev/null +++ b/scripts/gofmtcheck.sh | |||
@@ -0,0 +1,13 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # Check gofmt | ||
4 | echo "==> Checking that code complies with gofmt requirements..." | ||
5 | gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`) | ||
6 | if [[ -n ${gofmt_files} ]]; then | ||
7 | echo 'gofmt needs running on the following files:' | ||
8 | echo "${gofmt_files}" | ||
9 | echo "You can use the command: \`make fmt\` to reformat code." | ||
10 | exit 1 | ||
11 | fi | ||
12 | |||
13 | exit 0 | ||
diff --git a/scripts/gogetcookie.sh b/scripts/gogetcookie.sh new file mode 100755 index 0000000..26c63a6 --- /dev/null +++ b/scripts/gogetcookie.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | touch ~/.gitcookies | ||
4 | chmod 0600 ~/.gitcookies | ||
5 | |||
6 | git config --global http.cookiefile ~/.gitcookies | ||
7 | |||
8 | tr , \\t <<\__END__ >>~/.gitcookies | ||
9 | .googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE | ||
10 | __END__ | ||