gretl 1.0.5 → 1.1.0
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/lib/gretl.rb +33 -0
- 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: 4c766301a9c384e993a02eebdb5a67d600f457de87ac78baba481f3fcc8fca10
|
|
4
|
+
data.tar.gz: a025513173739016a89e6eb8b8413719bb6159d0ecae5c2af4a6bb726ec21999
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a07ef48d121f1fa1daa154533974aee8e44042b8bc90a632d4327c22d4c5de5baed59097021794eb20591447340c47f9d3156f3a4ddcef6529d77e82fa7fbd22
|
|
7
|
+
data.tar.gz: 4aaa684b0aaa0aa8c09f907a07c3a559dd1f96191a35fbb25f2267207dfcf008db9d4497f7dd95c955b6c55c376997c6136b1329bbf14c462ead7705d4e8c3b7
|
data/lib/gretl.rb
CHANGED
|
@@ -332,6 +332,39 @@ module Gretl
|
|
|
332
332
|
end
|
|
333
333
|
raise "Port matching #{query.inspect} did not become inactive within #{timeout}s"
|
|
334
334
|
end
|
|
335
|
+
|
|
336
|
+
# ── Agent gateway ─────────────────────────────────────────────────────────
|
|
337
|
+
|
|
338
|
+
def agent_list
|
|
339
|
+
Gretl._fetch_ports.select { |p| p.group&.downcase == "agents" }
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def agent_spinup(name, cmd: nil, port: nil)
|
|
343
|
+
unless port
|
|
344
|
+
used = Gretl._fetch_ports.map(&:port).to_set
|
|
345
|
+
port = 8100
|
|
346
|
+
port += 1 while used.include?(port) && port <= 8200
|
|
347
|
+
raise "No available ports in the agent range (8100–8200)" if port > 8200
|
|
348
|
+
end
|
|
349
|
+
add(port, name: name, cmd: cmd || "", group: "Agents")
|
|
350
|
+
Gretl._request(:post, "/ports/#{port}/start")
|
|
351
|
+
raw = Gretl._request(:get, "/ports/#{port}")
|
|
352
|
+
Gretl::PortInfo.new(**raw.slice(*Gretl::PortInfo.members))
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
def agent_spindown(name)
|
|
356
|
+
match = agent_list.find { |p| p.name.downcase == name.downcase }
|
|
357
|
+
raise ArgumentError, "No agent found with name #{name.inspect}" unless match
|
|
358
|
+
Gretl._request(:post, "/ports/#{match.port}/stop") if match.active
|
|
359
|
+
Gretl._request(:delete, "/ports/#{match.port}")
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def agent_logs(name, lines: 50)
|
|
363
|
+
match = agent_list.find { |p| p.name.downcase == name.downcase }
|
|
364
|
+
raise ArgumentError, "No agent found with name #{name.inspect}" unless match
|
|
365
|
+
raw = Gretl._request(:get, "/ports/#{match.port}/logs?lines=#{lines}")
|
|
366
|
+
raw[:lines] || []
|
|
367
|
+
end
|
|
335
368
|
end
|
|
336
369
|
|
|
337
370
|
# Default client — token read from GR_TOKEN env var
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gretl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gretl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|