tina4ruby 3.13.121 → 3.13.123
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/tina4/cli.rb +29 -1
- data/lib/tina4/middleware.rb +847 -818
- data/lib/tina4/version.rb +1 -1
- 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: bba43df1067e55a570ca814070fd8fa290f053751e072f824da4f48a3851b682
|
|
4
|
+
data.tar.gz: c244d0473f1a30888b2ea038f6d525a27453a01c4004ea03196fb364c04a8914
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ea085a630b15f124786bc91820c7fb1b5998d4b78a70dee351988fe9130afdf431b74d6755b17a994354a05f55cc7a94c0b7ec02124b7f61b84a800c29acd2d
|
|
7
|
+
data.tar.gz: 2f54c960351b66303631b973658c0d39c430b078cba6746151bdefb27d86c04c277f4e0556fae3b1d2ed415bca3852d34514d4874a3dcdb2ea0673f7524a9afb
|
data/lib/tina4/cli.rb
CHANGED
|
@@ -372,6 +372,16 @@ module Tina4
|
|
|
372
372
|
"Try it: tina4ruby serve -> http://localhost:7147#{route}",
|
|
373
373
|
]
|
|
374
374
|
end,
|
|
375
|
+
"queue" => lambda do |res|
|
|
376
|
+
file_path = res["file_path"] || "src/services/topic_consumer.rb"
|
|
377
|
+
slug = File.basename(file_path, ".rb").sub(/_consumer$/, "")
|
|
378
|
+
[
|
|
379
|
+
"Edit #{file_path}: implement handle_#{slug}(payload) to process ONE job",
|
|
380
|
+
"Produce a job: publish_#{slug}({ ... })",
|
|
381
|
+
"Run the worker: tina4ruby queue work #{slug}",
|
|
382
|
+
"Check stats: tina4ruby queue stats #{slug}",
|
|
383
|
+
]
|
|
384
|
+
end,
|
|
375
385
|
"view" => lambda do |res|
|
|
376
386
|
class_name = res["class_name"] || "View"
|
|
377
387
|
list_path = res["file_path"] || "src/templates/pages/list.twig"
|
|
@@ -1324,7 +1334,7 @@ module Tina4
|
|
|
1324
1334
|
# every other generator keeps its existing behaviour so nothing regresses.
|
|
1325
1335
|
# ADR-0063 (3.13.121): form + view joined so their baked `{# tina4:edit ... #}`
|
|
1326
1336
|
# markers surface in resolution.edit_hints[] under the same v1.1 envelope.
|
|
1327
|
-
resolution_aware = %w[model route migration middleware form view]
|
|
1337
|
+
resolution_aware = %w[model route migration middleware form view queue]
|
|
1328
1338
|
if !resolution_aware.include?(what)
|
|
1329
1339
|
send(gen_spec[:handler], name, flags)
|
|
1330
1340
|
return
|
|
@@ -1474,6 +1484,7 @@ module Tina4
|
|
|
1474
1484
|
when "middleware" then build_middleware_resolution(name, flags)
|
|
1475
1485
|
when "form" then build_form_resolution(name, flags)
|
|
1476
1486
|
when "view" then build_view_resolution(name, flags)
|
|
1487
|
+
when "queue" then build_queue_resolution(name, flags)
|
|
1477
1488
|
else
|
|
1478
1489
|
{ "class_name" => name.to_s, "table_name" => nil, "file_path" => nil,
|
|
1479
1490
|
"migration_path" => nil, "transformations" => [],
|
|
@@ -1559,6 +1570,23 @@ module Tina4
|
|
|
1559
1570
|
}
|
|
1560
1571
|
end
|
|
1561
1572
|
|
|
1573
|
+
# Slug computed EXACTLY as generate_queue does, so the envelope's paths
|
|
1574
|
+
# equal the on-disk filenames.
|
|
1575
|
+
def build_queue_resolution(name, _flags)
|
|
1576
|
+
topic = name.to_s.sub(%r{^/}, "")
|
|
1577
|
+
slug = to_snake_case(topic.gsub(/[^0-9a-zA-Z]+/, "_")).gsub(/\A_+|_+\z/, "")
|
|
1578
|
+
slug = "topic" if slug.empty?
|
|
1579
|
+
{
|
|
1580
|
+
"class_name" => nil,
|
|
1581
|
+
"table_name" => nil,
|
|
1582
|
+
"file_path" => "src/services/#{slug}_consumer.rb",
|
|
1583
|
+
"migration_path" => nil,
|
|
1584
|
+
"transformations" => [],
|
|
1585
|
+
"routes" => [],
|
|
1586
|
+
"test_paths" => ["spec/#{slug}_spec.rb"]
|
|
1587
|
+
}
|
|
1588
|
+
end
|
|
1589
|
+
|
|
1562
1590
|
# Form generator writes ONE Twig template in src/templates/forms/<snake>.twig.
|
|
1563
1591
|
# `file_path` names that primary file; the scanner walks every generated
|
|
1564
1592
|
# file in the sandbox, so the twig `{# tina4:edit ... #}` marker landing
|