Skip to content

Commit 9d00c5e

Browse files
wilsonAle Paredes
authored and
Ale Paredes
committed
Add bin/newver script for creating new Rubocop channels. (#129)
* Add `bin/newver` script for creating new Rubocop channels. * Adds make bundle and updates newver script * Make bundle uses docker, Following up on PR review and to be consistency with how we update gems in other repos
1 parent 7bdc8e4 commit 9d00c5e

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: image test docs
1+
.PHONY: image test docs bundle
22

33
IMAGE_NAME ?= codeclimate/codeclimate-rubocop
44

@@ -14,3 +14,9 @@ docs: image
1414
--workdir /usr/src/app \
1515
--volume $(PWD):/usr/src/app \
1616
$(IMAGE_NAME) sh -c "apk --update add git && bundle install --with=test && bundle exec rake docs:scrape"
17+
18+
bundle:
19+
docker run --rm \
20+
--entrypoint /bin/sh \
21+
--volume $(PWD):/usr/src/app \
22+
$(IMAGE_NAME) -c "cd /usr/src/app && bundle $(BUNDLE_ARGS)"

bin/newver

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
if [ $# -eq 0 ]; then
5+
>&2 echo "Usage: 'bin/newver X.Y.Z', where X.Y.Z is the Rubocop version to add."
6+
exit 1
7+
fi
8+
NEWVER="$1"
9+
10+
git checkout Gemfile*
11+
git checkout -b "newver/${NEWVER}"
12+
13+
ed Gemfile <<-EDITS
14+
/gem "parser",/c
15+
gem "parser"
16+
.
17+
/gem "rubocop",/c
18+
gem "rubocop", "~> ${NEWVER}", require: false
19+
.
20+
wq
21+
EDITS
22+
23+
make bundle -e BUNDLE_ARGS="update rubocop"
24+
make image
25+
make docs
26+
sudo chown -R $(id -u):$(id -g) config
27+
28+
set +e
29+
make test
30+
retval=$?
31+
if [ $retval -ne 0 ]; then
32+
>&2 echo "If tests fail, you may need to modify spec/support/currently_undocumented_cops.txt"
33+
exit $retval
34+
fi
35+
set -e
36+
37+
git add config spec Gemfile*
38+
git commit -v -m "Updated channel and documentation to Rubocop v${NEWVER}"

0 commit comments

Comments
 (0)