tina4ruby 3.13.92 → 3.13.93

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '099963e70978ad017383430b404b9cd1a2ff28f0563ca431f1e4adeec9b063fe'
4
- data.tar.gz: 190a787d77c3e73a4e48177c865f0e2bdb5c529c4483781ca59e2cdfe4303efa
3
+ metadata.gz: f7b916f1f99717b6933e8d4376b760d2c975daefec3b5507d9827480522cfe8f
4
+ data.tar.gz: e800d0a184690267eb84976193744593eea98b2ec355405f15a32214d12e31a0
5
5
  SHA512:
6
- metadata.gz: 86ab09867ede9d7587e600d0f98eb333ad767bd392ecd8c5251a5672e5957073d35cace49cee8507a900e568ee6d98bee85b1294d5b5031498e6f41379978481
7
- data.tar.gz: 7b42923a37f18d3a96821c0e19144524809d1c631920349ac5bcafcfea49944eea25fce473de20f5b2b19b05c3d1d25291a18b7ee0c7695e4096ab77419043aa
6
+ metadata.gz: 6428126904b059c914f08ca0fc446622a07447075c23e4a20ba12b01f93cf6a5c48454cab6cebfdc98da615f9fbb9ba57d4e3021d6b26d688cb92cdf5a553cb3
7
+ data.tar.gz: 7fb13ab4b8cae5c60ad932ed1a9de7750881381451b294747b6f90441b682dd5658f49394fd29707144fe2e4ae95a5639cb47cc50a6a1a87aae6b4d60eab0e29
data/README.md CHANGED
@@ -105,7 +105,7 @@ Tina4 Ruby outperforms Sinatra while delivering **98 features vs ~4**, with zero
105
105
 
106
106
  ## Cross-Framework Parity
107
107
 
108
- Tina4 ships identical features across four languages: same architecture, same conventions, same 97 features:
108
+ Tina4 ships identical features across four languages: same architecture, same conventions, same 98 features:
109
109
 
110
110
  | | Python | PHP | Ruby | Node.js |
111
111
  |---|--------|-----|------|---------|
data/lib/tina4/cli.rb CHANGED
@@ -467,12 +467,21 @@ module Tina4
467
467
  # ── start ─────────────────────────────────────────────────────────────
468
468
 
469
469
  def cmd_start(argv)
470
- options = { port: nil, host: nil, dev: false, no_browser: false, no_reload: false, production: false }
470
+ options = { port: nil, host: nil, dev: false, no_browser: false, no_reload: false, production: false,
471
+ managed: false }
471
472
  parser = OptionParser.new do |opts|
472
473
  opts.banner = "Usage: tina4ruby start [options]"
473
474
  opts.on("-p", "--port PORT", Integer, "Port (default: 7147)") { |v| options[:port] = v }
474
475
  opts.on("-h", "--host HOST", "Host (default: 0.0.0.0)") { |v| options[:host] = v }
475
476
  opts.on("-d", "--dev", "Enable dev mode with auto-reload") { options[:dev] = true }
477
+ # --managed says the Rust CLI owns this process (it supervises, watches
478
+ # files, and compiles SCSS, so the framework must not duplicate any of
479
+ # it). "managed" was already declared in boolean_flags above, but this
480
+ # parser never accepted it, so `tina4ruby serve --managed` died with
481
+ # OptionParser::InvalidOption -- which is precisely how the Rust CLI
482
+ # invokes PHP. That mismatch is why Ruby could not be launched through
483
+ # the shared launcher the other frameworks use.
484
+ opts.on("--managed", "Running under the tina4 CLI supervisor") { options[:managed] = true }
476
485
  opts.on("--production", "Use production server (Puma)") { options[:production] = true }
477
486
  opts.on("--no-browser", "Do not open browser on start") { options[:no_browser] = true }
478
487
  opts.on("--no-reload", "Disable file watcher / live-reload") { options[:no_reload] = true }
@@ -502,12 +511,10 @@ module Tina4
502
511
  root_dir = Dir.pwd
503
512
  Tina4.initialize!(root_dir)
504
513
 
505
- # Register health check endpoint
506
- Tina4::Health.register!
507
-
508
- # Register the always-on Frond {% live %} refresh endpoint
509
- # (GET /__frond/live/{name}) so server-rendered live blocks can poll/SSE.
510
- Tina4::Frond.register_live_endpoint!
514
+ # Built-in routes (health, Frond live). Shared with Tina4.run! so the two
515
+ # entry points cannot drift again -- they did, and app.rb served 404 on
516
+ # /health for it. register! is idempotent, so calling it here is safe.
517
+ Tina4.register_builtin_routes!
511
518
 
512
519
  # Load route files
513
520
  load_routes(root_dir)
data/lib/tina4/health.rb CHANGED
@@ -16,12 +16,22 @@ module Tina4
16
16
  end
17
17
 
18
18
  def register!
19
+ # Idempotent by ASKING THE ROUTER, not by remembering. run! and the CLI
20
+ # both call this, and it can run more than once per process. A boolean
21
+ # flag looked equivalent and was not: Router.clear! (every spec, and
22
+ # any re-init) wipes the routes while the flag stays true, so /health
23
+ # silently vanishes for the rest of the run. Querying the router is
24
+ # self-healing -- cleared routes re-register, present ones don't
25
+ # duplicate.
26
+ return if Tina4::Router.find_route("/health", "GET")
27
+
19
28
  # Register at the configured path. The legacy "/health" path stays
20
29
  # registered for backward-compat.
21
30
  Tina4::Router.add("GET", path, method(:handle))
22
31
  Tina4::Router.add("GET", "/health", method(:handle)) unless path == "/health"
23
32
  end
24
33
 
34
+
25
35
  def handle(_request, response)
26
36
  now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
27
37
  uptime = (now - START_TIME).round(2)
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.13.92"
4
+ VERSION = "3.13.93"
5
5
  end
data/lib/tina4.rb CHANGED
@@ -309,6 +309,14 @@ module Tina4
309
309
  end
310
310
  end
311
311
 
312
+ # The framework's own routes, in ONE place. Both entry points call this:
313
+ # Tina4.run! (app.rb) and the CLI's cmd_start. Anything added here is
314
+ # available however the app was launched -- which is the whole point.
315
+ def register_builtin_routes!
316
+ Tina4::Health.register!
317
+ Tina4::Frond.register_live_endpoint!
318
+ end
319
+
312
320
  def run!(root_dir = nil, port: nil, host: nil, debug: nil)
313
321
  # Handle legacy call: run!(port: 7147) where root_dir receives the hash
314
322
  if root_dir.is_a?(Hash)
@@ -325,6 +333,14 @@ module Tina4
325
333
 
326
334
  initialize!(root_dir) unless @root_dir
327
335
 
336
+ # Built-in routes. These used to be registered ONLY by the CLI's
337
+ # cmd_start, so an app booted the documented way -- `Tina4.run!` from
338
+ # app.rb, which is exactly what `tina4 init ruby` scaffolds -- served 404
339
+ # on /health while the identical code under `tina4ruby serve` served 200.
340
+ # A container health check pointed at /health therefore failed against a
341
+ # perfectly healthy app.
342
+ register_builtin_routes!
343
+
328
344
  host = ENV.fetch("HOST", ENV.fetch("TINA4_HOST", "0.0.0.0"))
329
345
  port = ENV.fetch("PORT", ENV.fetch("TINA4_PORT", "7147")).to_i
330
346
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.92
4
+ version: 3.13.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team