tina4ruby 3.11.15 → 3.11.17

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.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -80
  3. data/LICENSE.txt +21 -21
  4. data/README.md +137 -137
  5. data/exe/tina4ruby +5 -5
  6. data/lib/tina4/ai.rb +696 -696
  7. data/lib/tina4/api.rb +189 -189
  8. data/lib/tina4/auth.rb +305 -305
  9. data/lib/tina4/auto_crud.rb +244 -244
  10. data/lib/tina4/cache.rb +154 -154
  11. data/lib/tina4/cli.rb +1449 -1449
  12. data/lib/tina4/constants.rb +46 -46
  13. data/lib/tina4/container.rb +74 -74
  14. data/lib/tina4/cors.rb +74 -74
  15. data/lib/tina4/crud.rb +692 -692
  16. data/lib/tina4/database/sqlite3_adapter.rb +165 -165
  17. data/lib/tina4/database.rb +625 -625
  18. data/lib/tina4/database_result.rb +208 -208
  19. data/lib/tina4/debug.rb +8 -8
  20. data/lib/tina4/dev.rb +14 -14
  21. data/lib/tina4/dev_admin.rb +1291 -935
  22. data/lib/tina4/dev_mailbox.rb +191 -191
  23. data/lib/tina4/drivers/firebird_driver.rb +124 -124
  24. data/lib/tina4/drivers/mongodb_driver.rb +561 -561
  25. data/lib/tina4/drivers/mssql_driver.rb +112 -112
  26. data/lib/tina4/drivers/mysql_driver.rb +90 -90
  27. data/lib/tina4/drivers/odbc_driver.rb +191 -191
  28. data/lib/tina4/drivers/postgres_driver.rb +116 -116
  29. data/lib/tina4/drivers/sqlite_driver.rb +122 -122
  30. data/lib/tina4/env.rb +95 -95
  31. data/lib/tina4/error_overlay.rb +252 -252
  32. data/lib/tina4/events.rb +109 -109
  33. data/lib/tina4/field_types.rb +154 -154
  34. data/lib/tina4/frond.rb +2087 -2025
  35. data/lib/tina4/gallery/auth/meta.json +1 -1
  36. data/lib/tina4/gallery/auth/src/routes/api/gallery_auth.rb +114 -114
  37. data/lib/tina4/gallery/database/meta.json +1 -1
  38. data/lib/tina4/gallery/database/src/routes/api/gallery_db.rb +43 -43
  39. data/lib/tina4/gallery/error-overlay/meta.json +1 -1
  40. data/lib/tina4/gallery/error-overlay/src/routes/api/gallery_crash.rb +17 -17
  41. data/lib/tina4/gallery/orm/meta.json +1 -1
  42. data/lib/tina4/gallery/orm/src/routes/api/gallery_products.rb +16 -16
  43. data/lib/tina4/gallery/queue/meta.json +1 -1
  44. data/lib/tina4/gallery/queue/src/routes/api/gallery_queue.rb +325 -325
  45. data/lib/tina4/gallery/rest-api/meta.json +1 -1
  46. data/lib/tina4/gallery/rest-api/src/routes/api/gallery_hello.rb +14 -14
  47. data/lib/tina4/gallery/templates/meta.json +1 -1
  48. data/lib/tina4/gallery/templates/src/routes/gallery_page.rb +12 -12
  49. data/lib/tina4/gallery/templates/src/templates/gallery_page.twig +257 -257
  50. data/lib/tina4/graphql.rb +966 -966
  51. data/lib/tina4/health.rb +39 -39
  52. data/lib/tina4/html_element.rb +170 -170
  53. data/lib/tina4/job.rb +80 -80
  54. data/lib/tina4/localization.rb +168 -168
  55. data/lib/tina4/log.rb +203 -203
  56. data/lib/tina4/mcp.rb +871 -696
  57. data/lib/tina4/messenger.rb +587 -587
  58. data/lib/tina4/metrics.rb +793 -793
  59. data/lib/tina4/middleware.rb +445 -445
  60. data/lib/tina4/migration.rb +451 -451
  61. data/lib/tina4/orm.rb +790 -790
  62. data/lib/tina4/plan.rb +471 -0
  63. data/lib/tina4/project_index.rb +366 -0
  64. data/lib/tina4/public/css/tina4.css +2463 -2463
  65. data/lib/tina4/public/css/tina4.min.css +1 -1
  66. data/lib/tina4/public/images/logo.svg +5 -5
  67. data/lib/tina4/public/js/frond.min.js +2 -2
  68. data/lib/tina4/public/js/tina4-dev-admin.js +1264 -565
  69. data/lib/tina4/public/js/tina4-dev-admin.min.js +1264 -480
  70. data/lib/tina4/public/js/tina4.min.js +92 -92
  71. data/lib/tina4/public/js/tina4js.min.js +48 -48
  72. data/lib/tina4/public/swagger/index.html +90 -90
  73. data/lib/tina4/public/swagger/oauth2-redirect.html +63 -63
  74. data/lib/tina4/query_builder.rb +380 -380
  75. data/lib/tina4/queue.rb +366 -366
  76. data/lib/tina4/queue_backends/kafka_backend.rb +80 -80
  77. data/lib/tina4/queue_backends/lite_backend.rb +298 -298
  78. data/lib/tina4/queue_backends/mongo_backend.rb +126 -126
  79. data/lib/tina4/queue_backends/rabbitmq_backend.rb +73 -73
  80. data/lib/tina4/rack_app.rb +817 -817
  81. data/lib/tina4/rate_limiter.rb +130 -130
  82. data/lib/tina4/request.rb +268 -268
  83. data/lib/tina4/response.rb +346 -346
  84. data/lib/tina4/response_cache.rb +551 -551
  85. data/lib/tina4/router.rb +406 -406
  86. data/lib/tina4/scss/tina4css/_alerts.scss +34 -34
  87. data/lib/tina4/scss/tina4css/_badges.scss +22 -22
  88. data/lib/tina4/scss/tina4css/_buttons.scss +69 -69
  89. data/lib/tina4/scss/tina4css/_cards.scss +49 -49
  90. data/lib/tina4/scss/tina4css/_forms.scss +156 -156
  91. data/lib/tina4/scss/tina4css/_grid.scss +81 -81
  92. data/lib/tina4/scss/tina4css/_modals.scss +84 -84
  93. data/lib/tina4/scss/tina4css/_nav.scss +149 -149
  94. data/lib/tina4/scss/tina4css/_reset.scss +94 -94
  95. data/lib/tina4/scss/tina4css/_tables.scss +54 -54
  96. data/lib/tina4/scss/tina4css/_typography.scss +55 -55
  97. data/lib/tina4/scss/tina4css/_utilities.scss +197 -197
  98. data/lib/tina4/scss/tina4css/_variables.scss +117 -117
  99. data/lib/tina4/scss/tina4css/base.scss +1 -1
  100. data/lib/tina4/scss/tina4css/colors.scss +48 -48
  101. data/lib/tina4/scss/tina4css/tina4.scss +17 -17
  102. data/lib/tina4/scss_compiler.rb +178 -178
  103. data/lib/tina4/seeder.rb +567 -567
  104. data/lib/tina4/service_runner.rb +303 -303
  105. data/lib/tina4/session.rb +297 -297
  106. data/lib/tina4/session_handlers/database_handler.rb +72 -72
  107. data/lib/tina4/session_handlers/file_handler.rb +67 -67
  108. data/lib/tina4/session_handlers/mongo_handler.rb +49 -49
  109. data/lib/tina4/session_handlers/redis_handler.rb +43 -43
  110. data/lib/tina4/session_handlers/valkey_handler.rb +43 -43
  111. data/lib/tina4/shutdown.rb +84 -84
  112. data/lib/tina4/sql_translation.rb +158 -158
  113. data/lib/tina4/swagger.rb +124 -124
  114. data/lib/tina4/template.rb +894 -894
  115. data/lib/tina4/templates/base.twig +26 -26
  116. data/lib/tina4/templates/errors/302.twig +14 -14
  117. data/lib/tina4/templates/errors/401.twig +9 -9
  118. data/lib/tina4/templates/errors/403.twig +29 -29
  119. data/lib/tina4/templates/errors/404.twig +29 -29
  120. data/lib/tina4/templates/errors/500.twig +38 -38
  121. data/lib/tina4/templates/errors/502.twig +9 -9
  122. data/lib/tina4/templates/errors/503.twig +12 -12
  123. data/lib/tina4/templates/errors/base.twig +37 -37
  124. data/lib/tina4/test_client.rb +159 -159
  125. data/lib/tina4/testing.rb +340 -340
  126. data/lib/tina4/validator.rb +174 -174
  127. data/lib/tina4/version.rb +1 -1
  128. data/lib/tina4/webserver.rb +312 -312
  129. data/lib/tina4/websocket.rb +343 -343
  130. data/lib/tina4/websocket_backplane.rb +190 -190
  131. data/lib/tina4/wsdl.rb +564 -564
  132. data/lib/tina4.rb +460 -458
  133. data/lib/tina4ruby.rb +4 -4
  134. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2de27368e39bd367b02f6576df9b9b63a11c380414c56fb88bb6e084d29d7375
4
- data.tar.gz: 98466c233b46a441d18c45fef6b3b20cd081144cb1e71b16d837e3df8f2bb872
3
+ metadata.gz: c5bc93541bae10ff3eeaf0ab13618b899d3ea3ace7ae346c7e6c0fc77bf54cfb
4
+ data.tar.gz: 71bbbf40e7411a7955d675f3a479dddea6f93c17b7b8cc4b91459d738cefc70d
5
5
  SHA512:
6
- metadata.gz: 97438a31fbdef07c05fea16802ec8b1f1adc1c6ec75c3f5773814a88c2d570ef85b306afefcd2401e401826ab5966a2d63af9150ed5a7ae0f76b77d12886daa4
7
- data.tar.gz: 53af5a8cff1ba4ef87445eac76ac0f7e1d4e68b6349ab48b23a619758ddd7b681b4195f81b10e1d763c3de1a57d3d5ca6c92b6fd7654f1e5aef3ae4fb70c3cae
6
+ metadata.gz: 3b67f60cfd3f12f05d711151892963c935c5297dfd7533649e216cbff8ae1c9a1b383172191524594db2a1ef8a3bd529d58a3913fda910162d42b9e925aaf52a
7
+ data.tar.gz: d32f9309802ab0a5051eb330e39df3e43ec7612eb0b03715390871ee1c6413858c5e0a065dd486b1450578e5b3f93fd0a78e97feb6ff1d3e20b9591d587a0cb9
data/CHANGELOG.md CHANGED
@@ -1,80 +1,80 @@
1
- # Changelog
2
-
3
- ## [0.4.0] - 2026-03-18
4
-
5
- ### Added
6
- - Multi-stage Dockerfile (ruby:3.3-alpine, build + runtime stages, optimized layer caching)
7
- - .dockerignore for clean Docker builds
8
- - `tina4ruby init` now generates Dockerfile and .dockerignore alongside project scaffolding
9
-
10
- ## [0.3.0] - 2026-03-14
11
-
12
- ### Added
13
- - Zero-dependency GraphQL implementation (matching tina4php-graphql)
14
- - Recursive descent GraphQL parser (queries, mutations, fragments, variables, aliases)
15
- - Depth-first AST executor with resolver pattern
16
- - GraphQL schema with programmatic type registration
17
- - ORM auto-schema generation (`schema.from_orm(User)`) — auto-creates CRUD queries/mutations
18
- - GraphiQL UI served at GET /graphql
19
- - Route integration via `gql.register_route("/graphql")`
20
- - Full GraphQL type system (scalars, objects, lists, non-null, input objects)
21
-
22
- ## [0.2.0] - 2026-03-14
23
-
24
- ### Added
25
- - Default auth protection for POST/PUT/PATCH/DELETE routes (matching tina4_python behavior)
26
- - API_KEY bypass in bearer auth — if `ENV["API_KEY"]` matches the bearer token, access is granted
27
- - `auth: false` option to make write routes public (equivalent to tina4_python's `@noauth()`)
28
- - `default_secure_auth` cached auth handler for performance
29
- - `resolve_auth` helper for flexible auth resolution
30
- - Puma as default production server (WEBrick fallback)
31
- - `add_header` method on Response object
32
-
33
- ### Improved
34
- - Performance: lazy-initialized Request fields (headers, body, params, cookies, files)
35
- - Performance: pre-frozen CORS headers and OPTIONS response (zero allocation)
36
- - Performance: method-indexed route lookup (O(1) method filtering)
37
- - Performance: pre-computed static file roots at boot
38
- - Performance: fast-path for API routes skipping static file checks
39
- - Performance: cookie-less response fast path (no header duplication)
40
- - Router: normalized path computed once per request instead of per-route
41
- - Router: `match_path` returns params directly without redundant method check
42
- - Response: frozen content-type constants
43
- - Request: lazy `json_body` parsing
44
- - RackApp: skip `auto_detect` when handler returns response object directly
45
-
46
- ### Changed
47
- - GET routes remain public by default
48
- - POST/PUT/PATCH/DELETE routes are now secured by default (use `auth: false` to make public)
49
- - `any` routes default to public (`auth: false`)
50
- - `secure_*` variants now use `default_secure_auth` (cached lambda)
51
-
52
- ## [0.1.0] - 2026-03-14
53
-
54
- ### Added
55
- - Core framework with Rack-based request pipeline
56
- - DSL routing (get, post, put, patch, delete, any)
57
- - Path parameters with type casting ({id:int}, {id:float}, {id:path})
58
- - Route groups with shared auth handlers
59
- - Request/Response objects with auto-type detection
60
- - Puma production server (WEBrick fallback)
61
- - SQLite, PostgreSQL, MySQL, MSSQL, Firebird database drivers
62
- - Database abstraction with parameterized queries
63
- - ORM with field types DSL and CRUD operations
64
- - SQL migration runner
65
- - JWT RS256 authentication + bcrypt password hashing
66
- - File-based sessions with JWT tokens
67
- - Before/after middleware hooks
68
- - OpenAPI 3.0 Swagger auto-generation
69
- - Twig-compatible template engine (ERB fallback)
70
- - CRUD scaffolding
71
- - REST API client helper
72
- - WebSocket support
73
- - Message queue abstraction (file, RabbitMQ, Kafka backends)
74
- - SCSS auto-compilation
75
- - Dev reload with file watching
76
- - i18n localization
77
- - Inline testing framework
78
- - CLI commands (init, start, migrate, test)
79
- - .env auto-creation and loading
80
- - Colored debug logging with rotation
1
+ # Changelog
2
+
3
+ ## [0.4.0] - 2026-03-18
4
+
5
+ ### Added
6
+ - Multi-stage Dockerfile (ruby:3.3-alpine, build + runtime stages, optimized layer caching)
7
+ - .dockerignore for clean Docker builds
8
+ - `tina4ruby init` now generates Dockerfile and .dockerignore alongside project scaffolding
9
+
10
+ ## [0.3.0] - 2026-03-14
11
+
12
+ ### Added
13
+ - Zero-dependency GraphQL implementation (matching tina4php-graphql)
14
+ - Recursive descent GraphQL parser (queries, mutations, fragments, variables, aliases)
15
+ - Depth-first AST executor with resolver pattern
16
+ - GraphQL schema with programmatic type registration
17
+ - ORM auto-schema generation (`schema.from_orm(User)`) — auto-creates CRUD queries/mutations
18
+ - GraphiQL UI served at GET /graphql
19
+ - Route integration via `gql.register_route("/graphql")`
20
+ - Full GraphQL type system (scalars, objects, lists, non-null, input objects)
21
+
22
+ ## [0.2.0] - 2026-03-14
23
+
24
+ ### Added
25
+ - Default auth protection for POST/PUT/PATCH/DELETE routes (matching tina4_python behavior)
26
+ - API_KEY bypass in bearer auth — if `ENV["API_KEY"]` matches the bearer token, access is granted
27
+ - `auth: false` option to make write routes public (equivalent to tina4_python's `@noauth()`)
28
+ - `default_secure_auth` cached auth handler for performance
29
+ - `resolve_auth` helper for flexible auth resolution
30
+ - Puma as default production server (WEBrick fallback)
31
+ - `add_header` method on Response object
32
+
33
+ ### Improved
34
+ - Performance: lazy-initialized Request fields (headers, body, params, cookies, files)
35
+ - Performance: pre-frozen CORS headers and OPTIONS response (zero allocation)
36
+ - Performance: method-indexed route lookup (O(1) method filtering)
37
+ - Performance: pre-computed static file roots at boot
38
+ - Performance: fast-path for API routes skipping static file checks
39
+ - Performance: cookie-less response fast path (no header duplication)
40
+ - Router: normalized path computed once per request instead of per-route
41
+ - Router: `match_path` returns params directly without redundant method check
42
+ - Response: frozen content-type constants
43
+ - Request: lazy `json_body` parsing
44
+ - RackApp: skip `auto_detect` when handler returns response object directly
45
+
46
+ ### Changed
47
+ - GET routes remain public by default
48
+ - POST/PUT/PATCH/DELETE routes are now secured by default (use `auth: false` to make public)
49
+ - `any` routes default to public (`auth: false`)
50
+ - `secure_*` variants now use `default_secure_auth` (cached lambda)
51
+
52
+ ## [0.1.0] - 2026-03-14
53
+
54
+ ### Added
55
+ - Core framework with Rack-based request pipeline
56
+ - DSL routing (get, post, put, patch, delete, any)
57
+ - Path parameters with type casting ({id:int}, {id:float}, {id:path})
58
+ - Route groups with shared auth handlers
59
+ - Request/Response objects with auto-type detection
60
+ - Puma production server (WEBrick fallback)
61
+ - SQLite, PostgreSQL, MySQL, MSSQL, Firebird database drivers
62
+ - Database abstraction with parameterized queries
63
+ - ORM with field types DSL and CRUD operations
64
+ - SQL migration runner
65
+ - JWT RS256 authentication + bcrypt password hashing
66
+ - File-based sessions with JWT tokens
67
+ - Before/after middleware hooks
68
+ - OpenAPI 3.0 Swagger auto-generation
69
+ - Twig-compatible template engine (ERB fallback)
70
+ - CRUD scaffolding
71
+ - REST API client helper
72
+ - WebSocket support
73
+ - Message queue abstraction (file, RabbitMQ, Kafka backends)
74
+ - SCSS auto-compilation
75
+ - Dev reload with file watching
76
+ - i18n localization
77
+ - Inline testing framework
78
+ - CLI commands (init, start, migrate, test)
79
+ - .env auto-creation and loading
80
+ - Colored debug logging with rotation
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Tina4 Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Tina4 Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,137 +1,137 @@
1
- <p align="center">
2
- <img src="https://tina4.com/logo.svg" alt="Tina4" width="200">
3
- </p>
4
- <h1 align="center">Tina4 Ruby</h1>
5
- <h3 align="center">TINA4 — The Intelligent Native Application 4ramework</h3>
6
- <p align="center"><em>Simple. Fast. Human. &nbsp;|&nbsp; Built for AI. Built for you.</em></p>
7
- <p align="center">55 built-in features. Zero runtime dependencies. One require, everything works.</p>
8
- <p align="center">
9
- <a href="https://rubygems.org/gems/tina4ruby"><img src="https://img.shields.io/gem/v/tina4ruby?color=7b1fa2&label=RubyGems" alt="RubyGems"></a>
10
- <img src="https://img.shields.io/badge/tests-2%2C508%20passing-brightgreen" alt="Tests">
11
- <img src="https://img.shields.io/badge/features-55-blue" alt="Features">
12
- <img src="https://img.shields.io/badge/dependencies-0-brightgreen" alt="Zero Deps">
13
- <a href="https://tina4.com"><img src="https://img.shields.io/badge/docs-tina4.com-7b1fa2" alt="Docs"></a>
14
- </p>
15
-
16
- ---
17
-
18
- ## Quick Start
19
-
20
- ```bash
21
- # With the Tina4 CLI (recommended — enables SCSS + live reload)
22
- cargo install tina4 # or grab a binary from https://github.com/tina4stack/tina4/releases
23
- tina4 init ruby ./my-app
24
- cd my-app && tina4 serve
25
-
26
- # Without the Tina4 CLI
27
- gem install tina4ruby
28
- tina4ruby init my-app
29
- cd my-app && tina4ruby serve
30
- ```
31
-
32
- Open http://localhost:7147
33
-
34
- ---
35
-
36
- ## Code Examples
37
-
38
- ```ruby
39
- Tina4.get "/api/hello" do |request, response|
40
- response.call({ message: "Hello from Tina4!" }, Tina4::HTTP_OK)
41
- end
42
-
43
- class User < Tina4::ORM
44
- integer_field :id, primary_key: true, auto_increment: true
45
- string_field :name
46
- string_field :email
47
- end
48
-
49
- db = Tina4::Database.new("sqlite://app.db")
50
- ```
51
-
52
- ---
53
-
54
- ## What's Included
55
-
56
- | Category | Features |
57
- |----------|----------|
58
- | **Core HTTP** (7) | Router with path params (`{id:int}`, `{p:path}`), Server, Request/Response, Middleware pipeline, Static file serving, CORS |
59
- | **Database** (6) | SQLite, PostgreSQL, MySQL, MSSQL, Firebird — unified adapter, connection pooling, query cache, transactions, race-safe ID generation, SQL dialect translation |
60
- | **ORM** (7) | Active Record with typed fields, relationships (`has_one`/`has_many`/`belongs_to`), soft delete, QueryBuilder + MongoDB support, Auto-CRUD generator, migrations with rollback |
61
- | **Auth & Security** (5) | JWT (HS256/RS256), password hashing (PBKDF2-SHA256), API key validation, rate limiting, CSRF form tokens |
62
- | **Templating** (3) | Frond engine (Twig/Jinja2-compatible, pre-compiled 2.8× faster), SCSS auto-compilation, built-in CSS (~24 KB) |
63
- | **API & Integration** (5) | HTTP client (zero-dep), GraphQL with ORM auto-schema + GraphiQL IDE, WSDL/SOAP with auto WSDL, WebSocket (RFC 6455) + Redis backplane, MCP server (24 dev tools) |
64
- | **Background** (3) | Job queue (File/RabbitMQ/Kafka/MongoDB) with priority, delay, retry, dead letters — service runner — event system (on/emit/once/off) |
65
- | **Data & Storage** (4) | Session (File/Redis/Valkey/MongoDB/DB), response cache (LRU, TTL), seeder + 50+ fake data generators, messenger (SMTP/IMAP) |
66
- | **Developer Tools** (7) | Dev dashboard (11 tabs), dev toolbar, error overlay (Catppuccin Mocha), dev mailbox, hot reload + CSS hot-reload, code metrics (complexity, coupling, maintainability), AI context installer (7 tools) |
67
- | **Utilities** (7) | DI container (transient + singleton), HtmlElement builder, inline testing (`@tests` decorator), i18n (6 languages), Swagger/OpenAPI auto-generation, CLI scaffolding (`generate model/route/migration/middleware`), structured logging |
68
-
69
- **2,508 tests. Zero runtime dependencies. Full parity across Python, PHP, Ruby, and Node.js.**
70
-
71
- ---
72
-
73
- ## CLI Reference
74
-
75
- ```bash
76
- tina4ruby serve [--port PORT]
77
- tina4ruby migrate
78
- tina4ruby seed
79
- tina4ruby ai [--all]
80
- tina4ruby generate model <name>
81
- ```
82
-
83
- ---
84
-
85
- ## Performance
86
-
87
- Benchmarked with `wrk` — 5,000 requests, 50 concurrent, median of 3 runs:
88
-
89
- | Framework | JSON req/s | Deps | Features |
90
- |-----------|-----------|------|----------|
91
- | **Tina4 Ruby** | **10,243** | 0 | 55 |
92
- | Sinatra | 9,548 | 5+ | ~4 |
93
-
94
- Tina4 Ruby outperforms Sinatra while delivering **55 features vs ~4** — with zero runtime dependencies.
95
-
96
- **Across all 4 Tina4 implementations:**
97
-
98
- | | Python | PHP | Ruby | Node.js |
99
- |---|--------|-----|------|---------|
100
- | **JSON req/s** | 6,508 | 29,293 | 10,243 | 84,771 |
101
- | **Dependencies** | 0 | 0 | 0 | 0 |
102
- | **Features** | 55 | 55 | 55 | 55 |
103
-
104
- ---
105
-
106
- ## Cross-Framework Parity
107
-
108
- Tina4 ships identical features across four languages — same architecture, same conventions, same 55 features:
109
-
110
- | | Python | PHP | Ruby | Node.js |
111
- |---|--------|-----|------|---------|
112
- | **Package** | `tina4-python` | `tina4stack/tina4php` | `tina4ruby` | `@tina4/core` |
113
- | **Tests (v3.11.12)** | 2,281 | 2,073 | 2,508 | 2,897 |
114
- | **Default port** | 7146 | 7145 | 7147 | 7148 |
115
-
116
- **~9,700 tests** across all 4 frameworks. See [tina4.com](https://tina4.com).
117
-
118
- ---
119
-
120
- ## Documentation
121
-
122
- Full guides, API reference, and examples at **[tina4.com](https://tina4.com)**.
123
-
124
- ## License
125
-
126
- MIT (c) 2007-2026 Tina4 Stack
127
- https://opensource.org/licenses/MIT
128
-
129
- ---
130
-
131
- ## Our Sponsors
132
-
133
- **Sponsored with 🩵 by Code Infinity**
134
-
135
- [<img src="https://codeinfinity.co.za/wp-content/uploads/2025/09/c8e-logo-github.png" alt="Code Infinity" width="100">](https://codeinfinity.co.za/about-open-source-policy?utm_source=github&utm_medium=website&utm_campaign=opensource_campaign&utm_id=opensource)
136
-
137
- *Supporting open source communities • Innovate • Code • Empower*
1
+ <p align="center">
2
+ <img src="https://tina4.com/logo.svg" alt="Tina4" width="200">
3
+ </p>
4
+ <h1 align="center">Tina4 Ruby</h1>
5
+ <h3 align="center">TINA4 — The Intelligent Native Application 4ramework</h3>
6
+ <p align="center"><em>Simple. Fast. Human. &nbsp;|&nbsp; Built for AI. Built for you.</em></p>
7
+ <p align="center">55 built-in features. Zero runtime dependencies. One require, everything works.</p>
8
+ <p align="center">
9
+ <a href="https://rubygems.org/gems/tina4ruby"><img src="https://img.shields.io/gem/v/tina4ruby?color=7b1fa2&label=RubyGems" alt="RubyGems"></a>
10
+ <img src="https://img.shields.io/badge/tests-2%2C508%20passing-brightgreen" alt="Tests">
11
+ <img src="https://img.shields.io/badge/features-55-blue" alt="Features">
12
+ <img src="https://img.shields.io/badge/dependencies-0-brightgreen" alt="Zero Deps">
13
+ <a href="https://tina4.com"><img src="https://img.shields.io/badge/docs-tina4.com-7b1fa2" alt="Docs"></a>
14
+ </p>
15
+
16
+ ---
17
+
18
+ ## Quick Start
19
+
20
+ ```bash
21
+ # With the Tina4 CLI (recommended — enables SCSS + live reload)
22
+ cargo install tina4 # or grab a binary from https://github.com/tina4stack/tina4/releases
23
+ tina4 init ruby ./my-app
24
+ cd my-app && tina4 serve
25
+
26
+ # Without the Tina4 CLI
27
+ gem install tina4ruby
28
+ tina4ruby init my-app
29
+ cd my-app && tina4ruby serve
30
+ ```
31
+
32
+ Open http://localhost:7147
33
+
34
+ ---
35
+
36
+ ## Code Examples
37
+
38
+ ```ruby
39
+ Tina4.get "/api/hello" do |request, response|
40
+ response.call({ message: "Hello from Tina4!" }, Tina4::HTTP_OK)
41
+ end
42
+
43
+ class User < Tina4::ORM
44
+ integer_field :id, primary_key: true, auto_increment: true
45
+ string_field :name
46
+ string_field :email
47
+ end
48
+
49
+ db = Tina4::Database.new("sqlite://app.db")
50
+ ```
51
+
52
+ ---
53
+
54
+ ## What's Included
55
+
56
+ | Category | Features |
57
+ |----------|----------|
58
+ | **Core HTTP** (7) | Router with path params (`{id:int}`, `{p:path}`), Server, Request/Response, Middleware pipeline, Static file serving, CORS |
59
+ | **Database** (6) | SQLite, PostgreSQL, MySQL, MSSQL, Firebird — unified adapter, connection pooling, query cache, transactions, race-safe ID generation, SQL dialect translation |
60
+ | **ORM** (7) | Active Record with typed fields, relationships (`has_one`/`has_many`/`belongs_to`), soft delete, QueryBuilder + MongoDB support, Auto-CRUD generator, migrations with rollback |
61
+ | **Auth & Security** (5) | JWT (HS256/RS256), password hashing (PBKDF2-SHA256), API key validation, rate limiting, CSRF form tokens |
62
+ | **Templating** (3) | Frond engine (Twig/Jinja2-compatible, pre-compiled 2.8× faster), SCSS auto-compilation, built-in CSS (~24 KB) |
63
+ | **API & Integration** (5) | HTTP client (zero-dep), GraphQL with ORM auto-schema + GraphiQL IDE, WSDL/SOAP with auto WSDL, WebSocket (RFC 6455) + Redis backplane, MCP server (24 dev tools) |
64
+ | **Background** (3) | Job queue (File/RabbitMQ/Kafka/MongoDB) with priority, delay, retry, dead letters — service runner — event system (on/emit/once/off) |
65
+ | **Data & Storage** (4) | Session (File/Redis/Valkey/MongoDB/DB), response cache (LRU, TTL), seeder + 50+ fake data generators, messenger (SMTP/IMAP) |
66
+ | **Developer Tools** (7) | Dev dashboard (11 tabs), dev toolbar, error overlay (Catppuccin Mocha), dev mailbox, hot reload + CSS hot-reload, code metrics (complexity, coupling, maintainability), AI context installer (7 tools) |
67
+ | **Utilities** (7) | DI container (transient + singleton), HtmlElement builder, inline testing (`@tests` decorator), i18n (6 languages), Swagger/OpenAPI auto-generation, CLI scaffolding (`generate model/route/migration/middleware`), structured logging |
68
+
69
+ **2,508 tests. Zero runtime dependencies. Full parity across Python, PHP, Ruby, and Node.js.**
70
+
71
+ ---
72
+
73
+ ## CLI Reference
74
+
75
+ ```bash
76
+ tina4ruby serve [--port PORT]
77
+ tina4ruby migrate
78
+ tina4ruby seed
79
+ tina4ruby ai [--all]
80
+ tina4ruby generate model <name>
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Performance
86
+
87
+ Benchmarked with `wrk` — 5,000 requests, 50 concurrent, median of 3 runs:
88
+
89
+ | Framework | JSON req/s | Deps | Features |
90
+ |-----------|-----------|------|----------|
91
+ | **Tina4 Ruby** | **10,243** | 0 | 55 |
92
+ | Sinatra | 9,548 | 5+ | ~4 |
93
+
94
+ Tina4 Ruby outperforms Sinatra while delivering **55 features vs ~4** — with zero runtime dependencies.
95
+
96
+ **Across all 4 Tina4 implementations:**
97
+
98
+ | | Python | PHP | Ruby | Node.js |
99
+ |---|--------|-----|------|---------|
100
+ | **JSON req/s** | 6,508 | 29,293 | 10,243 | 84,771 |
101
+ | **Dependencies** | 0 | 0 | 0 | 0 |
102
+ | **Features** | 55 | 55 | 55 | 55 |
103
+
104
+ ---
105
+
106
+ ## Cross-Framework Parity
107
+
108
+ Tina4 ships identical features across four languages — same architecture, same conventions, same 55 features:
109
+
110
+ | | Python | PHP | Ruby | Node.js |
111
+ |---|--------|-----|------|---------|
112
+ | **Package** | `tina4-python` | `tina4stack/tina4php` | `tina4ruby` | `@tina4/core` |
113
+ | **Tests (v3.11.12)** | 2,281 | 2,073 | 2,508 | 2,897 |
114
+ | **Default port** | 7146 | 7145 | 7147 | 7148 |
115
+
116
+ **~9,700 tests** across all 4 frameworks. See [tina4.com](https://tina4.com).
117
+
118
+ ---
119
+
120
+ ## Documentation
121
+
122
+ Full guides, API reference, and examples at **[tina4.com](https://tina4.com)**.
123
+
124
+ ## License
125
+
126
+ MIT (c) 2007-2026 Tina4 Stack
127
+ https://opensource.org/licenses/MIT
128
+
129
+ ---
130
+
131
+ ## Our Sponsors
132
+
133
+ **Sponsored with 🩵 by Code Infinity**
134
+
135
+ [<img src="https://codeinfinity.co.za/wp-content/uploads/2025/09/c8e-logo-github.png" alt="Code Infinity" width="100">](https://codeinfinity.co.za/about-open-source-policy?utm_source=github&utm_medium=website&utm_campaign=opensource_campaign&utm_id=opensource)
136
+
137
+ *Supporting open source communities • Innovate • Code • Empower*
data/exe/tina4ruby CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative "../lib/tina4/cli"
5
- Tina4::CLI.start(ARGV)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../lib/tina4/cli"
5
+ Tina4::CLI.start(ARGV)