tarsier 0.1.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 (47) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +175 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +984 -0
  5. data/exe/tarsier +7 -0
  6. data/lib/tarsier/application.rb +336 -0
  7. data/lib/tarsier/cli/commands/console.rb +87 -0
  8. data/lib/tarsier/cli/commands/generate.rb +85 -0
  9. data/lib/tarsier/cli/commands/help.rb +50 -0
  10. data/lib/tarsier/cli/commands/new.rb +59 -0
  11. data/lib/tarsier/cli/commands/routes.rb +139 -0
  12. data/lib/tarsier/cli/commands/server.rb +123 -0
  13. data/lib/tarsier/cli/commands/version.rb +14 -0
  14. data/lib/tarsier/cli/generators/app.rb +528 -0
  15. data/lib/tarsier/cli/generators/base.rb +93 -0
  16. data/lib/tarsier/cli/generators/controller.rb +91 -0
  17. data/lib/tarsier/cli/generators/middleware.rb +81 -0
  18. data/lib/tarsier/cli/generators/migration.rb +109 -0
  19. data/lib/tarsier/cli/generators/model.rb +109 -0
  20. data/lib/tarsier/cli/generators/resource.rb +27 -0
  21. data/lib/tarsier/cli/loader.rb +18 -0
  22. data/lib/tarsier/cli.rb +46 -0
  23. data/lib/tarsier/controller.rb +282 -0
  24. data/lib/tarsier/database.rb +588 -0
  25. data/lib/tarsier/errors.rb +77 -0
  26. data/lib/tarsier/middleware/base.rb +47 -0
  27. data/lib/tarsier/middleware/compression.rb +113 -0
  28. data/lib/tarsier/middleware/cors.rb +101 -0
  29. data/lib/tarsier/middleware/csrf.rb +88 -0
  30. data/lib/tarsier/middleware/logger.rb +74 -0
  31. data/lib/tarsier/middleware/rate_limit.rb +110 -0
  32. data/lib/tarsier/middleware/stack.rb +143 -0
  33. data/lib/tarsier/middleware/static.rb +124 -0
  34. data/lib/tarsier/model.rb +590 -0
  35. data/lib/tarsier/params.rb +269 -0
  36. data/lib/tarsier/query.rb +495 -0
  37. data/lib/tarsier/request.rb +274 -0
  38. data/lib/tarsier/response.rb +282 -0
  39. data/lib/tarsier/router/compiler.rb +173 -0
  40. data/lib/tarsier/router/node.rb +97 -0
  41. data/lib/tarsier/router/route.rb +119 -0
  42. data/lib/tarsier/router.rb +272 -0
  43. data/lib/tarsier/version.rb +5 -0
  44. data/lib/tarsier/websocket.rb +275 -0
  45. data/lib/tarsier.rb +167 -0
  46. data/sig/tarsier.rbs +485 -0
  47. metadata +230 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 01eb416d71704d9bd9fa4ec5b9cbdf04cf8e4384343791a4895c57b97e275bcc
4
+ data.tar.gz: 1e4c18917ba174fda64094a4fe20bc2b5df714b3d797e0f7175b155829f0d8cd
5
+ SHA512:
6
+ metadata.gz: 29edfa202c43d584aab94b16dd876824adf232425c500f57d2d89ba39cc5f992e8d7bc0e59a740c889b275dfd6a7533d0a4b4cb70c09d8514bff025ae32310ee
7
+ data.tar.gz: f0a3a46be85efeb607f0b4398be3e4b529d452c9f2f295982c5eff43be336429e69e57a27d4ab1be0c5835724a42e73ae0619f9e01f7594ad0e30d08b8de4a2b
data/CHANGELOG.md ADDED
@@ -0,0 +1,175 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+
11
+ ## [0.1.0] - 2025-01-01
12
+
13
+ ### Added
14
+
15
+ #### Core Framework
16
+ - Application container with configuration management
17
+ - Environment detection (development, production, test)
18
+ - Rack-compatible interface with optimized direct dispatch
19
+
20
+ #### Routing
21
+ - Compiled radix tree router with sub-millisecond matching
22
+ - RESTful resource routing with full CRUD support
23
+ - Nested resources and singular resources
24
+ - Namespace and scope support for route organization
25
+ - Route constraints with regular expression patterns
26
+ - Wildcard route parameters
27
+ - Named routes with path generation
28
+ - Route compilation at boot time for zero runtime overhead
29
+
30
+ #### Request Handling
31
+ - Immutable request objects with lazy parsing
32
+ - Automatic body parsing for JSON and form data
33
+ - Query string parameter extraction
34
+ - Cookie parsing and access
35
+ - Header normalization and access
36
+ - Client IP detection with proxy support
37
+ - Content negotiation helpers
38
+
39
+ #### Response Handling
40
+ - Fluent response builder API
41
+ - JSON, HTML, and plain text rendering
42
+ - Response streaming with chunked transfer encoding
43
+ - Cookie setting and deletion
44
+ - Redirect helpers with status code support
45
+ - Rack-compatible response format
46
+
47
+ #### Controllers
48
+ - Action-based controller architecture
49
+ - Before, after, and around filters
50
+ - Filter options (only, except) for selective application
51
+ - Parameter validation with type coercion
52
+ - Built-in parameter schema definition
53
+ - Exception rescue handlers
54
+ - Session and flash message access
55
+ - File sending capabilities
56
+
57
+ #### Parameter Handling
58
+ - Type coercion for common types (String, Integer, Float, Boolean, Date, Time)
59
+ - Required and optional parameter declaration
60
+ - Validation rules (presence, format, length, inclusion, numericality)
61
+ - Parameter permitting and slicing
62
+ - Nested parameter support
63
+
64
+ #### Middleware
65
+ - Fiber-aware middleware stack
66
+ - Middleware insertion, deletion, and swapping
67
+ - Per-route middleware support
68
+ - Built-in middleware suite:
69
+ - CORS (Cross-Origin Resource Sharing)
70
+ - CSRF (Cross-Site Request Forgery) protection
71
+ - Rate limiting with sliding window algorithm
72
+ - Response compression (gzip, deflate)
73
+ - Static file serving with caching
74
+ - Request logging with timing
75
+
76
+ #### WebSocket and SSE
77
+ - Native WebSocket handling
78
+ - Room and channel abstraction for pub/sub
79
+ - Broadcast mechanisms
80
+ - Server-Sent Events support
81
+ - Connection lifecycle hooks
82
+
83
+ #### ORM
84
+ - Lightweight Active Record pattern implementation
85
+ - Attribute definition with type coercion
86
+ - Validation framework
87
+ - Association declarations (has_many, has_one, belongs_to)
88
+ - Query builder with chainable methods
89
+ - SQL generation for common operations
90
+
91
+ #### CLI
92
+ - Project scaffolding with `tarsier new`
93
+ - Code generators for controllers, models, resources, middleware, migrations
94
+ - Development server command
95
+ - Interactive console
96
+ - Route inspection command
97
+ - Version information
98
+
99
+ #### Developer Experience
100
+ - Detailed error pages in development mode
101
+ - Route listing for debugging
102
+ - Comprehensive YARD documentation
103
+ - RBS type signatures for static analysis
104
+
105
+ #### Testing
106
+ - RSpec test suite with 257 specifications
107
+ - Integration tests for full request cycle
108
+ - Middleware chain testing
109
+ - CLI and generator testing
110
+
111
+ #### Documentation
112
+ - Complete README with usage examples
113
+ - API documentation with YARD
114
+ - Example application
115
+
116
+ ### Security
117
+ - CSRF token validation for state-changing requests
118
+ - Secure cookie defaults (HttpOnly, SameSite)
119
+ - Rate limiting to prevent abuse
120
+ - Input validation and sanitization
121
+ - Constant-time token comparison
122
+
123
+ ### Performance
124
+ - 700,000+ routes/second for static routes
125
+ - 250,000+ routes/second for parameterized routes
126
+ - Lazy request parsing to minimize allocations
127
+ - Compiled route matching with zero runtime overhead
128
+ - Response compression for bandwidth optimization
129
+
130
+ #### Database Layer
131
+ - Multi-database support with unified interface (SQLite, PostgreSQL, MySQL)
132
+ - Connection management with lazy loading
133
+ - Query execution with parameterized queries
134
+ - Transaction support with automatic rollback on error
135
+ - Migration system with table creation, modification, and rollback
136
+ - Table definition DSL for migrations
137
+ - Column types: string, text, integer, bigint, float, decimal, boolean, date, datetime, timestamp, time, binary, json
138
+ - Column constraints: NOT NULL, DEFAULT values
139
+ - Foreign key references
140
+ - Index creation
141
+
142
+ #### Model Enhancements
143
+ - Database-backed persistence with automatic SQL generation
144
+ - `find`, `find!`, `find_by` class methods
145
+ - `create`, `create!` class methods
146
+ - `save`, `save!`, `update`, `update!`, `destroy` instance methods
147
+ - `count`, `exists?` class methods
148
+ - Query integration with `where`, `order`, `limit`, `offset`
149
+
150
+ #### Query Builder Improvements
151
+ - Range support in where clauses (`where(age: 18..30)`)
152
+ - Array support for IN queries (`where(status: ['active', 'pending'])`)
153
+ - `joins` method for table joins
154
+ - `includes` method for eager loading associations
155
+ - `pluck` method for selecting specific columns
156
+ - `ids` method for fetching primary keys
157
+ - `update_all` and `delete_all` for bulk operations
158
+ - `find_or_create_by` and `find_or_initialize_by` methods
159
+
160
+ ### Changed
161
+ - Improved YARD documentation across all modules
162
+ - Enhanced error messages for database operations
163
+ - Query `to_sql` now generates human-readable SQL for debugging
164
+
165
+ ### Planned
166
+ - Background job processing module
167
+ - View rendering with template engine support
168
+ - Session management middleware
169
+ - Asset pipeline integration
170
+
171
+ ---
172
+
173
+ ## Version History
174
+
175
+ - **0.1.0** - Initial release with core framework functionality
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tarsier 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.