gergich 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/gergich/capture.rb +17 -6
- data/lib/gergich/cli/gergich.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb586bf1a73532571ecb8cf4b34679a8f1f3e71
|
4
|
+
data.tar.gz: 02530fba1d33d28ca675a7c63273949f9ee88030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b8371b9cc0109757c2e83fe9e9bdf89cbc20730352fd72b761002258cce61501bdb81d56f2707d266cdfcf465b3e148653ea9f12cbe68c80f3cc072c3f3ef13
|
7
|
+
data.tar.gz: 51b2ed7c6a62ddfaa72062dfb039f8b2d5f21a23647c6d68557b1380e255bbe050836302c37dde74f57aa572ec58a9a8cf912f0a7f0e8e91dcc7e8fa9f9577de
|
data/README.md
CHANGED
@@ -95,7 +95,10 @@ do `gergich comment` calls so you don't have to wire it up yourself.
|
|
95
95
|
* `custom:<path>:<class_name>` - file path and ruby class_name of a custom
|
96
96
|
formatter.
|
97
97
|
|
98
|
-
`<command>` - The command to run whose output
|
98
|
+
`<command>` - The command to run whose output conforms to `<format>`.
|
99
|
+
Output from the command will still go to STDOUT, and Gergich will
|
100
|
+
preserve its exit status. If command is "-", Gergich will simply read
|
101
|
+
from STDIN and the exit status will always be 0.
|
99
102
|
|
100
103
|
#### Custom formatters:
|
101
104
|
|
@@ -123,6 +126,9 @@ gergich capture eslint eslint
|
|
123
126
|
gergich capture i18nliner "rake i18nliner:check"
|
124
127
|
|
125
128
|
gergich capture custom:./gergich/xss:Gergich::XSS "node script/xsslint"
|
129
|
+
|
130
|
+
docker-compose run --rm web eslint | gergich capture eslint -
|
131
|
+
# you might be interested in $PIPESTATUS[0]
|
126
132
|
```
|
127
133
|
|
128
134
|
### `gergich publish`
|
data/lib/gergich/capture.rb
CHANGED
@@ -32,18 +32,29 @@ module Gergich
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def run_command(command)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
exit_code = 0
|
36
|
+
|
37
|
+
if command == "-"
|
38
|
+
output = wiretap($stdin)
|
39
|
+
else
|
40
|
+
IO.popen("#{command} 2>&1", "r+") do |io|
|
41
|
+
output = wiretap(io)
|
40
42
|
end
|
43
|
+
exit_code = $CHILD_STATUS.exitstatus
|
41
44
|
end
|
42
|
-
exit_code = $CHILD_STATUS && $CHILD_STATUS.exitstatus || 0
|
43
45
|
|
44
46
|
[exit_code, output]
|
45
47
|
end
|
46
48
|
|
49
|
+
def wiretap(io)
|
50
|
+
output = ""
|
51
|
+
io.each do |line|
|
52
|
+
puts line
|
53
|
+
output << line
|
54
|
+
end
|
55
|
+
output
|
56
|
+
end
|
57
|
+
|
47
58
|
def load_captor(format)
|
48
59
|
if (match = format.match(/\Acustom:(?<path>.+?):(?<class_name>.+)\z/))
|
49
60
|
load_custom_captor(match[:path], match[:class_name])
|
data/lib/gergich/cli/gergich.rb
CHANGED
@@ -206,7 +206,11 @@ do `gergich comment` calls so you don't have to wire it up yourself.
|
|
206
206
|
* custom:<path>:<class_name> - file path and ruby
|
207
207
|
class_name of a custom formatter.
|
208
208
|
|
209
|
-
<command> - The command to run whose output conforms to <format
|
209
|
+
<command> - The command to run whose output conforms to <format>.
|
210
|
+
Output from the command will still go to STDOUT, and
|
211
|
+
Gergich will preserve its exit status.
|
212
|
+
If command is "-", Gergich will simply read from STDIN
|
213
|
+
and the exit status will always be 0.
|
210
214
|
|
211
215
|
Examples:
|
212
216
|
gergich capture rubocop "bundle exec rubocop"
|
@@ -217,6 +221,8 @@ Examples:
|
|
217
221
|
|
218
222
|
gergich capture custom:./gergich/xss:Gergich::XSS "node script/xsslint"
|
219
223
|
|
224
|
+
docker-compose run --rm web eslint | gergich capture eslint -
|
225
|
+
# you might be interested in $PIPESTATUS[0]
|
220
226
|
TEXT
|
221
227
|
}
|
222
228
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gergich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|