omq-cli 0.15.2 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/lib/omq/cli/base_runner.rb +1 -1
- data/lib/omq/cli/expression_evaluator.rb +5 -2
- data/lib/omq/cli/parallel_worker.rb +1 -1
- data/lib/omq/cli/req_rep.rb +24 -10
- data/lib/omq/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b503b668b3427210a067278ba175bbda172e98ccf19df42f4dcf4cc84cd1dd4
|
|
4
|
+
data.tar.gz: 9861f0dd910a0ca723b97043996a8c5e47c2222efd77321f8f1e43efdc872818
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82972297897d9ea36f3a10ecad3372b476ae935e9b4d20ff312f23db5ecee438b52b0a443d814048f4dab8d5e5243e927509a994917b4926058d80c3f314188b
|
|
7
|
+
data.tar.gz: cbca40c66d0061a3d51782e3b1cf001aad9d44596f2b9203a7d6837c087049227565456f07646de7e2788d827ce91a1ba5290fa7c8792f103475b867ee663c28
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.3 — 2026-04-16
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Cache decoded `--data` input.** `read_inline_data` and
|
|
8
|
+
`ParallelWorker#compute_reply` now memoize the decoded result
|
|
9
|
+
instead of re-decoding the same literal on every iteration.
|
|
10
|
+
|
|
11
|
+
## Unreleased
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **REQ generator mode (`-E`/`-e` with no stdin).** `omq req` now
|
|
16
|
+
produces each request from the send-eval alone when no `-d`/`-f`
|
|
17
|
+
is given and stdin is not piped, matching the existing PUSH/PUB
|
|
18
|
+
behaviour. Bounded by `-n` or paced by `-i` like the other
|
|
19
|
+
generator-capable runners.
|
|
20
|
+
|
|
21
|
+
### Tests
|
|
22
|
+
|
|
23
|
+
- **System tests for REQ and PUB `-E` generator mode.** REQ fires
|
|
24
|
+
`-E'"foo"' -n 3` against a REP running `-e '|(a)| a.upcase' -n 3`
|
|
25
|
+
and verifies three `FOO` replies round-trip. PUB fires
|
|
26
|
+
`-E'"tick"' -i 0.05 -n 3` against a SUB and verifies three `tick`
|
|
27
|
+
frames are received.
|
|
28
|
+
- **System tests split into themed files under `test/system/`.** The
|
|
29
|
+
monolithic `test/system_test.sh` is replaced by 12 standalone files
|
|
30
|
+
(req_rep, push_pull, pub_sub, router_dealer, format, compression,
|
|
31
|
+
interval, transport, script, validation, pipe, parallel) sharing
|
|
32
|
+
`support.sh` helpers. `run_all.sh` chains them; each file also runs
|
|
33
|
+
standalone. `rake test:system` now invokes `run_all.sh`.
|
|
34
|
+
|
|
3
35
|
## 0.15.2 — 2026-04-15
|
|
4
36
|
|
|
5
37
|
### Fixed
|
data/lib/omq/cli/base_runner.rb
CHANGED
|
@@ -422,7 +422,7 @@ module OMQ
|
|
|
422
422
|
|
|
423
423
|
def read_inline_data
|
|
424
424
|
if config.data
|
|
425
|
-
@fmt.decode(config.data + "\n")
|
|
425
|
+
@inline_data ||= @fmt.decode(config.data + "\n")
|
|
426
426
|
else
|
|
427
427
|
@file_data ||= (config.file == "-" ? $stdin.read : File.read(config.file)).chomp
|
|
428
428
|
@fmt.decode(@file_data + "\n")
|
|
@@ -28,6 +28,7 @@ module OMQ
|
|
|
28
28
|
expr, begin_body, end_body = extract_blocks(src)
|
|
29
29
|
@begin_proc = eval("proc { #{begin_body} }") if begin_body
|
|
30
30
|
@end_proc = eval("proc { #{end_body} }") if end_body
|
|
31
|
+
|
|
31
32
|
if expr && !expr.strip.empty?
|
|
32
33
|
@eval_proc = eval("proc { #{expr} }")
|
|
33
34
|
end
|
|
@@ -85,6 +86,7 @@ module OMQ
|
|
|
85
86
|
begin_proc = eval("proc { #{begin_body} }") if begin_body
|
|
86
87
|
end_proc = eval("proc { #{end_body} }") if end_body
|
|
87
88
|
eval_proc = nil
|
|
89
|
+
|
|
88
90
|
if expr && !expr.strip.empty?
|
|
89
91
|
eval_proc = eval("proc { #{expr} }")
|
|
90
92
|
end
|
|
@@ -100,12 +102,12 @@ module OMQ
|
|
|
100
102
|
# (Ractors cannot call back into instance state).
|
|
101
103
|
#
|
|
102
104
|
def self.extract_block(expr, keyword)
|
|
103
|
-
start = expr.index(/#{keyword}\s*\{/)
|
|
104
|
-
return [expr, nil] unless start
|
|
105
|
+
start = expr.index(/#{keyword}\s*\{/) or return [expr, nil]
|
|
105
106
|
|
|
106
107
|
i = expr.index("{", start)
|
|
107
108
|
depth = 1
|
|
108
109
|
j = i + 1
|
|
110
|
+
|
|
109
111
|
while j < expr.length && depth > 0
|
|
110
112
|
case expr[j]
|
|
111
113
|
when "{"
|
|
@@ -113,6 +115,7 @@ module OMQ
|
|
|
113
115
|
when "}"
|
|
114
116
|
depth -= 1
|
|
115
117
|
end
|
|
118
|
+
|
|
116
119
|
j += 1
|
|
117
120
|
end
|
|
118
121
|
|
data/lib/omq/cli/req_rep.rb
CHANGED
|
@@ -10,19 +10,27 @@ module OMQ
|
|
|
10
10
|
def run_loop(task)
|
|
11
11
|
n = config.count
|
|
12
12
|
i = 0
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
sleep config.delay if config.delay
|
|
15
|
+
generator = @send_eval_proc && !config.data && !config.file && !stdin_ready?
|
|
16
|
+
|
|
14
17
|
loop do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
if generator
|
|
19
|
+
parts = eval_send_expr(nil)
|
|
20
|
+
else
|
|
21
|
+
parts = read_next
|
|
22
|
+
break unless parts
|
|
23
|
+
parts = eval_send_expr(parts)
|
|
24
|
+
end
|
|
25
|
+
|
|
18
26
|
next unless parts
|
|
27
|
+
|
|
19
28
|
send_msg(parts)
|
|
20
|
-
reply = recv_msg
|
|
21
|
-
break if reply.nil?
|
|
29
|
+
reply = recv_msg or break
|
|
22
30
|
output(eval_recv_expr(reply))
|
|
23
31
|
i += 1
|
|
24
32
|
break if n && n > 0 && i >= n
|
|
25
|
-
break if !config.interval && (config.data || config.file)
|
|
33
|
+
break if !config.interval && (generator || config.data || config.file) && !(n && n > 0)
|
|
26
34
|
wait_for_interval if config.interval
|
|
27
35
|
end
|
|
28
36
|
end
|
|
@@ -38,7 +46,11 @@ module OMQ
|
|
|
38
46
|
# Runner for REP sockets (synchronous request-reply server).
|
|
39
47
|
class RepRunner < BaseRunner
|
|
40
48
|
def call(task)
|
|
41
|
-
config.parallel
|
|
49
|
+
if config.parallel
|
|
50
|
+
run_parallel_workers(:REP)
|
|
51
|
+
else
|
|
52
|
+
super
|
|
53
|
+
end
|
|
42
54
|
end
|
|
43
55
|
|
|
44
56
|
|
|
@@ -48,9 +60,9 @@ module OMQ
|
|
|
48
60
|
def run_loop(task)
|
|
49
61
|
n = config.count
|
|
50
62
|
i = 0
|
|
63
|
+
|
|
51
64
|
loop do
|
|
52
|
-
msg = recv_msg
|
|
53
|
-
break if msg.nil?
|
|
65
|
+
msg = recv_msg or break
|
|
54
66
|
break unless handle_rep_request(msg)
|
|
55
67
|
i += 1
|
|
56
68
|
break if n && n > 0 && i >= n
|
|
@@ -61,6 +73,7 @@ module OMQ
|
|
|
61
73
|
def handle_rep_request(msg)
|
|
62
74
|
if config.recv_expr || @recv_eval_proc
|
|
63
75
|
reply = eval_recv_expr(msg)
|
|
76
|
+
|
|
64
77
|
unless reply.equal?(SENT)
|
|
65
78
|
output(reply)
|
|
66
79
|
send_msg(reply || [""])
|
|
@@ -76,6 +89,7 @@ module OMQ
|
|
|
76
89
|
else
|
|
77
90
|
abort "REP needs a reply source: --echo, --data, --file, -e, or stdin pipe"
|
|
78
91
|
end
|
|
92
|
+
|
|
79
93
|
true
|
|
80
94
|
end
|
|
81
95
|
end
|
data/lib/omq/cli/version.rb
CHANGED