Skip to content

Commit 2a04242

Browse files
PMD Version 5.8.1 (#10)
* PMD Version 5.8.1 * Use `make upgrade` to setup a newer version
1 parent 1d5eb4b commit 2a04242

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing
2+
3+
## Testing
4+
`make test` will build the docker image and run the tests
5+
6+
## Upgrading PMD Version
7+
1. `make upgrade` => will adjust `bin/install-pmd.sh` with the URL to the latest version
8+
1. `make test`
9+
1. If all looks good, commit the change and open a PR :)

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ image:
77

88
test: image
99
docker run --rm -v $(PWD):/code $(IMAGE_NAME) /code/test.groovy
10+
11+
upgrade:
12+
docker run --rm \
13+
--workdir /usr/src/app \
14+
--volume $(PWD):/usr/src/app \
15+
$(IMAGE_NAME) ./bin/upgrade.sh

bin/install-pmd.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ set -euo pipefail
33

44
LIB_DIR=/usr/src/app/lib
55

6-
download_latest_pmd() {
7-
curl -s https://api.github.com/repos/pmd/pmd/releases/latest | \
8-
jq -c '.assets[] | select(.name | contains("bin")) | .browser_download_url' | \
9-
xargs wget -O pmd.zip
6+
download_pmd() {
7+
URL="https://github.com/pmd/pmd/releases/download/pmd_releases/5.8.1/pmd-bin-5.8.1.zip"
8+
wget -O pmd.zip $URL
109
}
1110

1211
install_pmd() {
13-
download_latest_pmd
1412
unzip pmd.zip
1513
mv ${LIB_DIR}/pmd-bin*/* ${LIB_DIR}/pmd
1614
}
@@ -23,5 +21,6 @@ cleanup() {
2321
mkdir -p ${LIB_DIR}/pmd
2422
cd ${LIB_DIR}
2523

24+
download_pmd
2625
install_pmd
2726
cleanup

bin/upgrade.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
URL=$(curl -s https://api.github.com/repos/pmd/pmd/releases/latest | jq -c '.assets[] | select(.name | contains("bin")) | .browser_download_url')
4+
ESCAPED_URL=$(echo $URL | sed 's/\&/\\&/g')
5+
sed -i -E "s#URL=.*#URL=${ESCAPED_URL}#" bin/install-pmd.sh
6+
7+
echo $ESCAPED_URL

0 commit comments

Comments
 (0)