dorian-each 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/each +52 -2
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44309e092f94e766bcf71b6aa5dfaf199f6a03d9c5c07b2f5230f1e7a5463313
|
4
|
+
data.tar.gz: 63a19748a5f3883017241b1a878e7367efaa2cf06b0ba74d03391d30edd4f54e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb106b922ffd95dafd6acc877c6a0d4b92a412895ad33dc8dca378f87a334314eb4e7560eb149469554f2a0a1e5969dd504fbff8fcc896b2209d8fcba374f547
|
7
|
+
data.tar.gz: 70a8bdb382804b98de4063cec9d3792a4deb4119cbf2416e491f14f0d11f20c5c7782108f533aca20a357dff67d76d4cdc4907c5eb98b39ea90d448bdc244c4b
|
data/bin/each
CHANGED
@@ -2,8 +2,44 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "dorian/arguments"
|
5
|
+
require "dorian/eval"
|
6
|
+
require "dorian/progress"
|
5
7
|
|
6
|
-
parsed =
|
8
|
+
parsed =
|
9
|
+
Dorian::Arguments.parse(
|
10
|
+
debug: {
|
11
|
+
alias: :d
|
12
|
+
},
|
13
|
+
stdout: {
|
14
|
+
aliases: %i[out o],
|
15
|
+
default: true
|
16
|
+
},
|
17
|
+
stderr: {
|
18
|
+
aliases: %i[err e],
|
19
|
+
default: true
|
20
|
+
},
|
21
|
+
colorize: {
|
22
|
+
aliases: %i[color c],
|
23
|
+
default: true
|
24
|
+
},
|
25
|
+
progress: {
|
26
|
+
alias: :p
|
27
|
+
},
|
28
|
+
progress_format: {
|
29
|
+
type: :string,
|
30
|
+
alias: :pf,
|
31
|
+
default: "full"
|
32
|
+
},
|
33
|
+
rails: {
|
34
|
+
alias: :r
|
35
|
+
},
|
36
|
+
version: {
|
37
|
+
alias: :v
|
38
|
+
},
|
39
|
+
help: {
|
40
|
+
alias: :h
|
41
|
+
}
|
42
|
+
)
|
7
43
|
|
8
44
|
abort parsed.help if parsed.options.help
|
9
45
|
|
@@ -13,4 +49,18 @@ end
|
|
13
49
|
|
14
50
|
input = parsed.files.map { |file| File.read(file) }.join("\n")
|
15
51
|
input = $stdin.each_line.to_a.map(&:strip).join("\n") if input.empty?
|
16
|
-
input.lines.map(&:strip)
|
52
|
+
inputs = input.lines.map(&:strip)
|
53
|
+
ruby = parsed.arguments.join(" ")
|
54
|
+
debug = parsed.options.debug
|
55
|
+
progress = parsed.options.progress
|
56
|
+
stdout = parsed.options.stdout
|
57
|
+
stderr = parsed.options.stderr
|
58
|
+
colorize = parsed.options.colorize
|
59
|
+
total = inputs.size
|
60
|
+
format = parsed.options.progress_format
|
61
|
+
progress = progress ? Dorian::Progress.create(total:, format:) : nil
|
62
|
+
|
63
|
+
inputs.each do |it|
|
64
|
+
Dorian::Eval.eval(it:, ruby:, debug:, stdout:, stderr:, colorize:)
|
65
|
+
progress&.increment
|
66
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-each
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dorian-eval
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dorian-progress
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
description: evaluates some code on each line of the input
|
28
56
|
email: dorian@dorianmarie.com
|
29
57
|
executables:
|