tina4 0.2.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 (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +61 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +662 -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 +243 -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_reload.rb +68 -0
  14. data/lib/tina4/drivers/firebird_driver.rb +94 -0
  15. data/lib/tina4/drivers/mssql_driver.rb +112 -0
  16. data/lib/tina4/drivers/mysql_driver.rb +90 -0
  17. data/lib/tina4/drivers/postgres_driver.rb +99 -0
  18. data/lib/tina4/drivers/sqlite_driver.rb +85 -0
  19. data/lib/tina4/env.rb +55 -0
  20. data/lib/tina4/field_types.rb +84 -0
  21. data/lib/tina4/localization.rb +100 -0
  22. data/lib/tina4/middleware.rb +59 -0
  23. data/lib/tina4/migration.rb +124 -0
  24. data/lib/tina4/orm.rb +168 -0
  25. data/lib/tina4/queue.rb +117 -0
  26. data/lib/tina4/queue_backends/kafka_backend.rb +80 -0
  27. data/lib/tina4/queue_backends/lite_backend.rb +79 -0
  28. data/lib/tina4/queue_backends/rabbitmq_backend.rb +73 -0
  29. data/lib/tina4/rack_app.rb +150 -0
  30. data/lib/tina4/request.rb +158 -0
  31. data/lib/tina4/response.rb +172 -0
  32. data/lib/tina4/router.rb +142 -0
  33. data/lib/tina4/scss_compiler.rb +131 -0
  34. data/lib/tina4/session.rb +145 -0
  35. data/lib/tina4/session_handlers/file_handler.rb +55 -0
  36. data/lib/tina4/session_handlers/mongo_handler.rb +49 -0
  37. data/lib/tina4/session_handlers/redis_handler.rb +43 -0
  38. data/lib/tina4/swagger.rb +123 -0
  39. data/lib/tina4/template.rb +478 -0
  40. data/lib/tina4/templates/base.twig +25 -0
  41. data/lib/tina4/templates/errors/403.twig +22 -0
  42. data/lib/tina4/templates/errors/404.twig +22 -0
  43. data/lib/tina4/templates/errors/500.twig +22 -0
  44. data/lib/tina4/testing.rb +213 -0
  45. data/lib/tina4/version.rb +5 -0
  46. data/lib/tina4/webserver.rb +101 -0
  47. data/lib/tina4/websocket.rb +167 -0
  48. data/lib/tina4/wsdl.rb +164 -0
  49. data/lib/tina4.rb +233 -0
  50. metadata +303 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 43ddb7daa0a71fd29538497f46e1387cb8acaed0c6609db13b1a2462f6198ade
4
+ data.tar.gz: 761ceeff217c275682aa53f1d5a7f2e30a199327e936687eef69413d762e0316
5
+ SHA512:
6
+ metadata.gz: d636d691b826f1234b87336c94be4418bfb113d055486d25b41e41426e3c0708b333665cb8c4ca14afe9b64a29b208d239742f895ccefb11e0f8022f52ca51d8
7
+ data.tar.gz: fc03efefcd6eb2647a3790e01e31bbc0944217f411f2f39945c8f96eab1f33136cf6b03ca0aa1a453f3f8a4ce06ffa3ff9530903c48df88967fc1d4fe8e395de
data/CHANGELOG.md ADDED
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0] - 2026-03-14
4
+
5
+ ### Added
6
+ - Default auth protection for POST/PUT/PATCH/DELETE routes (matching tina4_python behavior)
7
+ - API_KEY bypass in bearer auth — if `ENV["API_KEY"]` matches the bearer token, access is granted
8
+ - `auth: false` option to make write routes public (equivalent to tina4_python's `@noauth()`)
9
+ - `default_secure_auth` cached auth handler for performance
10
+ - `resolve_auth` helper for flexible auth resolution
11
+ - Puma as default production server (WEBrick fallback)
12
+ - `add_header` method on Response object
13
+
14
+ ### Improved
15
+ - Performance: lazy-initialized Request fields (headers, body, params, cookies, files)
16
+ - Performance: pre-frozen CORS headers and OPTIONS response (zero allocation)
17
+ - Performance: method-indexed route lookup (O(1) method filtering)
18
+ - Performance: pre-computed static file roots at boot
19
+ - Performance: fast-path for API routes skipping static file checks
20
+ - Performance: cookie-less response fast path (no header duplication)
21
+ - Router: normalized path computed once per request instead of per-route
22
+ - Router: `match_path` returns params directly without redundant method check
23
+ - Response: frozen content-type constants
24
+ - Request: lazy `json_body` parsing
25
+ - RackApp: skip `auto_detect` when handler returns response object directly
26
+
27
+ ### Changed
28
+ - GET routes remain public by default
29
+ - POST/PUT/PATCH/DELETE routes are now secured by default (use `auth: false` to make public)
30
+ - `any` routes default to public (`auth: false`)
31
+ - `secure_*` variants now use `default_secure_auth` (cached lambda)
32
+
33
+ ## [0.1.0] - 2026-03-14
34
+
35
+ ### Added
36
+ - Core framework with Rack-based request pipeline
37
+ - DSL routing (get, post, put, patch, delete, any)
38
+ - Path parameters with type casting ({id:int}, {id:float}, {id:path})
39
+ - Route groups with shared auth handlers
40
+ - Request/Response objects with auto-type detection
41
+ - Puma production server (WEBrick fallback)
42
+ - SQLite, PostgreSQL, MySQL, MSSQL, Firebird database drivers
43
+ - Database abstraction with parameterized queries
44
+ - ORM with field types DSL and CRUD operations
45
+ - SQL migration runner
46
+ - JWT RS256 authentication + bcrypt password hashing
47
+ - File-based sessions with JWT tokens
48
+ - Before/after middleware hooks
49
+ - OpenAPI 3.0 Swagger auto-generation
50
+ - Twig-compatible template engine (ERB fallback)
51
+ - CRUD scaffolding
52
+ - REST API client helper
53
+ - WebSocket support
54
+ - Message queue abstraction (file, RabbitMQ, Kafka backends)
55
+ - SCSS auto-compilation
56
+ - Dev reload with file watching
57
+ - i18n localization
58
+ - Inline testing framework
59
+ - CLI commands (init, start, migrate, test)
60
+ - .env auto-creation and loading
61
+ - 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.