dorian-each 0.4.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/each +64 -6
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca854a994308f8b2ee7fed80c26e9dd141112db047e9678aa9ae026bb4ece9cd
|
4
|
+
data.tar.gz: 873f8c9dd7326c6fa3f32d53fa26b95a38e3e265ee40c07ffc6927aa80e8b306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b81831f4bedec525b4d50c2e44f01a24185c8dc801258937c8f1ed9258de200f83fa8b966095cd5fe1ed245a71a19593c4e0ba48683dda338fde5b67cdb87bd
|
7
|
+
data.tar.gz: d2d2e4cde64439d58e59283c2fbfe415d0cd566c3d8eba09f35fc051a0478584bd4811cb136e2f79e5b4334e420d9f14c6bb85acf38542863c74547b996c1d97
|
data/bin/each
CHANGED
@@ -1,12 +1,70 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require "dorian/arguments"
|
5
|
+
require "dorian/eval"
|
6
|
+
require "dorian/progress"
|
7
|
+
|
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
|
+
)
|
43
|
+
|
44
|
+
abort parsed.help if parsed.options.help
|
45
|
+
|
46
|
+
if parsed.options.version
|
47
|
+
abort File.read(File.expand_path("../../VERSION", __FILE__))
|
48
|
+
end
|
49
|
+
|
50
|
+
input = parsed.files.map { |file| File.read(file) }.join("\n")
|
51
|
+
input = $stdin.each_line.to_a.map(&:strip).join("\n") if input.empty?
|
52
|
+
inputs = input.lines.map(&:strip)
|
53
|
+
ruby = parsed.arguments.join(" ")
|
54
|
+
debug = parsed.options.debug
|
55
|
+
stdout = parsed.options.stdout && !parsed.options.progress
|
56
|
+
stderr = parsed.options.stderr && !parsed.options.progress
|
57
|
+
colorize = parsed.options.colorize
|
58
|
+
total = inputs.size
|
59
|
+
format = parsed.options.progress_format
|
60
|
+
|
61
|
+
if parsed.options.progress
|
62
|
+
progress = Dorian::Progress.create(total:, format:)
|
63
|
+
else
|
64
|
+
progress = nil
|
7
65
|
end
|
8
66
|
|
9
|
-
|
10
|
-
it
|
11
|
-
|
67
|
+
inputs.each do |it|
|
68
|
+
Dorian::Eval.eval(it:, ruby:, debug:, stdout:, stderr:, colorize:)
|
69
|
+
progress&.increment
|
12
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-each
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dorian-arguments
|
@@ -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:
|