Skip to content

Commit cd6ad87

Browse files
committed
Add Shell script to import/update rubocop-truffleruby cops
1 parent 8c776c5 commit cd6ad87

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tool/import-rubocop-truffleruby.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# This file should pass `shellcheck tool/import-rubocop-truffleruby.sh`.
4+
5+
set -x
6+
set -e
7+
8+
SOURCE_DIR="../rubocop-truffleruby"
9+
SOURCE_PATH="lib/rubocop/cop/truffleruby"
10+
TARGET_DIR="tool/rubocop-truffleruby"
11+
GIT_REPO_URL="[email protected]:andrykonchin/rubocop-truffleruby.git"
12+
13+
if [ ! -d "$SOURCE_DIR" ]; then
14+
mkdir -p $SOURCE_DIR
15+
fi
16+
17+
# clone the repository if the SOURCE_DIR is empty
18+
if [ ! "$(ls $SOURCE_DIR)" ]; then
19+
if ! git clone $GIT_REPO_URL $SOURCE_DIR; then
20+
echo "FAILURE: git clone failed"
21+
fi
22+
fi
23+
cp $SOURCE_DIR/$SOURCE_PATH/* $TARGET_DIR/cop/

tool/rubocop-truffleruby/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Rubocop::TruffleRuby
2+
3+
There are some TruffleRuby specific Rubocop copes (a Ruby linter policies) in a `./cop` directory.
4+
5+
They are taken from a `rubocop-truffleruby` gem (https://github.com/andrykonchin/rubocop-truffleruby) and should be synchronized every time the gem is updated.
6+
7+
Use `tool/import-rubocop-truffleruby.sh` Shell script to update them automatically:
8+
9+
```shell
10+
tool/import-rubocop-truffleruby.sh
11+
```
12+
13+
The script expects `../rubocop-truffleruby` directory to contain a cloned `rubocop-truffleruby` repository. Otherwise it clones the Git repository itself.

0 commit comments

Comments
 (0)