tina4ruby 0.4.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.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +80 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +768 -0
  5. data/exe/tina4 +4 -0
  6. data/lib/tina4/api.rb +152 -0
  7. data/lib/tina4/auth.rb +139 -0
  8. data/lib/tina4/cli.rb +349 -0
  9. data/lib/tina4/crud.rb +124 -0
  10. data/lib/tina4/database.rb +135 -0
  11. data/lib/tina4/database_result.rb +89 -0
  12. data/lib/tina4/debug.rb +83 -0
  13. data/lib/tina4/dev.rb +15 -0
  14. data/lib/tina4/dev_reload.rb +68 -0
  15. data/lib/tina4/drivers/firebird_driver.rb +94 -0
  16. data/lib/tina4/drivers/mssql_driver.rb +112 -0
  17. data/lib/tina4/drivers/mysql_driver.rb +90 -0
  18. data/lib/tina4/drivers/postgres_driver.rb +99 -0
  19. data/lib/tina4/drivers/sqlite_driver.rb +85 -0
  20. data/lib/tina4/env.rb +55 -0
  21. data/lib/tina4/field_types.rb +84 -0
  22. data/lib/tina4/graphql.rb +837 -0
  23. data/lib/tina4/localization.rb +100 -0
  24. data/lib/tina4/middleware.rb +59 -0
  25. data/lib/tina4/migration.rb +124 -0
  26. data/lib/tina4/orm.rb +168 -0
  27. data/lib/tina4/public/css/tina4.css +2286 -0
  28. data/lib/tina4/public/css/tina4.min.css +2 -0
  29. data/lib/tina4/public/js/tina4.js +134 -0
  30. data/lib/tina4/public/js/tina4helper.js +387 -0
  31. data/lib/tina4/queue.rb +117 -0
  32. data/lib/tina4/queue_backends/kafka_backend.rb +80 -0
  33. data/lib/tina4/queue_backends/lite_backend.rb +79 -0
  34. data/lib/tina4/queue_backends/rabbitmq_backend.rb +73 -0
  35. data/lib/tina4/rack_app.rb +150 -0
  36. data/lib/tina4/request.rb +158 -0
  37. data/lib/tina4/response.rb +172 -0
  38. data/lib/tina4/router.rb +148 -0
  39. data/lib/tina4/scss/tina4css/_alerts.scss +34 -0
  40. data/lib/tina4/scss/tina4css/_badges.scss +22 -0
  41. data/lib/tina4/scss/tina4css/_buttons.scss +69 -0
  42. data/lib/tina4/scss/tina4css/_cards.scss +49 -0
  43. data/lib/tina4/scss/tina4css/_forms.scss +156 -0
  44. data/lib/tina4/scss/tina4css/_grid.scss +81 -0
  45. data/lib/tina4/scss/tina4css/_modals.scss +84 -0
  46. data/lib/tina4/scss/tina4css/_nav.scss +149 -0
  47. data/lib/tina4/scss/tina4css/_reset.scss +94 -0
  48. data/lib/tina4/scss/tina4css/_tables.scss +54 -0
  49. data/lib/tina4/scss/tina4css/_typography.scss +55 -0
  50. data/lib/tina4/scss/tina4css/_utilities.scss +197 -0
  51. data/lib/tina4/scss/tina4css/_variables.scss +117 -0
  52. data/lib/tina4/scss/tina4css/base.scss +1 -0
  53. data/lib/tina4/scss/tina4css/colors.scss +48 -0
  54. data/lib/tina4/scss/tina4css/tina4.scss +17 -0
  55. data/lib/tina4/scss_compiler.rb +131 -0
  56. data/lib/tina4/seeder.rb +529 -0
  57. data/lib/tina4/session.rb +145 -0
  58. data/lib/tina4/session_handlers/file_handler.rb +55 -0
  59. data/lib/tina4/session_handlers/mongo_handler.rb +49 -0
  60. data/lib/tina4/session_handlers/redis_handler.rb +43 -0
  61. data/lib/tina4/swagger.rb +123 -0
  62. data/lib/tina4/template.rb +478 -0
  63. data/lib/tina4/templates/base.twig +26 -0
  64. data/lib/tina4/templates/errors/403.twig +22 -0
  65. data/lib/tina4/templates/errors/404.twig +22 -0
  66. data/lib/tina4/templates/errors/500.twig +22 -0
  67. data/lib/tina4/testing.rb +213 -0
  68. data/lib/tina4/version.rb +5 -0
  69. data/lib/tina4/webserver.rb +101 -0
  70. data/lib/tina4/websocket.rb +167 -0
  71. data/lib/tina4/wsdl.rb +164 -0
  72. data/lib/tina4.rb +259 -0
  73. data/lib/tina4ruby.rb +4 -0
  74. metadata +324 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 21e81c7d2b4f653ae64aa9a56e45534a48432c9914ef70b7e41d11d41ac83a40
4
+ data.tar.gz: 38a0c3ea03aafc8593bdb49a217026592017816ecef416fac96e352e1f0899f6
5
+ SHA512:
6
+ metadata.gz: c4ff78f4cfddafab5cd3dedf8393e1ed3f25b973cf22113ebd73c780b0b10fc04a84991c9a6b98b3cac2533d372be2c80f4f93cb8cec006e0394e1e1758e70dc
7
+ data.tar.gz: c3d340186e084c3166266af6c7a5155e837dc69f27bd7ebb85f9d4e70c3e428e1b71691e7a788f3f347deafaedb4f3a4c995b55ae55764f39912b04623c18da6
data/CHANGELOG.md ADDED
@@ -0,0 +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
+ - `tina4 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 ADDED
@@ -0,0 +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.