rubocop-daemon 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rubocop-daemon-wrapper +25 -1
- data/lib/rubocop/daemon/cache.rb +2 -1
- data/lib/rubocop/daemon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e34a73d9ee5a5f38b2a531efc3a19103b93ae9eef54faea95751820815c893b4
|
4
|
+
data.tar.gz: 9968fd324e630f5ad2d40f9c9895d4dec8a03e016087ba3b95978a126ee045ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b61796952aa7762a0a4ecb967e6f0d3da0ad54c45395789255cbd188646d8662f0a2f31a8fd82b7fcfaad184fbed69df641c64ea5904bd7ffaa5d454fb36cf
|
7
|
+
data.tar.gz: e1dd9d6eccb027a1f4ddc3316fa488d69983108d5381348f0397ab8f01aa5b270846c3fec43cadeab28e5d5e93e5fd8f56d178c8dd6c3d48390c2228336084bb
|
data/bin/rubocop-daemon-wrapper
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
set -e
|
3
3
|
|
4
|
+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
5
|
+
NETCAT_CMD="nc -N"
|
6
|
+
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
7
|
+
NETCAT_CMD="nc"
|
8
|
+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
|
9
|
+
# https://www.freebsd.org/cgi/man.cgi?query=netcat&manpath=SuSE+Linux/i386+11.3
|
10
|
+
NETCAT_CMD="nc"
|
11
|
+
else
|
12
|
+
echo "Sorry, we're not sure if the rubocop-daemon-wrapper script will work" \
|
13
|
+
"on your OS: \"$OSTYPE\"" >&2
|
14
|
+
echo "Try to comment out this message in the script, and use one of the following:" >&2
|
15
|
+
echo >&2
|
16
|
+
echo "NETCAT_CMD=\"nc\"" >&2
|
17
|
+
echo "# Or" >&2
|
18
|
+
echo "NETCAT_CMD=\"nc -N\"" >&2
|
19
|
+
echo >&2
|
20
|
+
echo "Then please leave a comment on this GitHub issue and" \
|
21
|
+
"let us know which one worked:" >&2
|
22
|
+
echo >&2
|
23
|
+
echo "* https://github.com/fohte/rubocop-daemon/issues/4" >&2
|
24
|
+
echo >&2
|
25
|
+
exit 1
|
26
|
+
fi
|
27
|
+
|
4
28
|
find_project_root() {
|
5
29
|
path=$(pwd -P)
|
6
30
|
while [[ "$path" != "" && ! -f "$path/Gemfile" && ! -f "$path/gems.rb" ]]; do
|
@@ -39,7 +63,7 @@ run_rubocop_command() {
|
|
39
63
|
PORT="$(cat "$PORT_PATH")"
|
40
64
|
COMMAND="$TOKEN $PROJECT_ROOT exec $@"
|
41
65
|
rm -f "$STATUS_PATH" # Clear the previous status
|
42
|
-
if echo -e "$COMMAND${STDIN_CONTENT}" |
|
66
|
+
if echo -e "$COMMAND${STDIN_CONTENT}" | $NETCAT_CMD localhost "$PORT"; then
|
43
67
|
if [ -f "$STATUS_PATH" ]; then
|
44
68
|
exit "$(cat $STATUS_PATH)"
|
45
69
|
else
|
data/lib/rubocop/daemon/cache.rb
CHANGED
@@ -59,8 +59,9 @@ module RuboCop
|
|
59
59
|
|
60
60
|
def acquire_lock
|
61
61
|
lock_file = File.open(lock_path, File::CREAT)
|
62
|
+
# flock returns 0 if successful, and false if not.
|
62
63
|
flock_result = lock_file.flock(File::LOCK_EX | File::LOCK_NB)
|
63
|
-
yield flock_result
|
64
|
+
yield flock_result != false
|
64
65
|
ensure
|
65
66
|
lock_file.flock(File::LOCK_UN)
|
66
67
|
lock_file.close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-daemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hayato Kawai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|