stipa 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/stipa/app.rb +8 -2
- data/lib/stipa/generators/base.rb +4 -1
- data/lib/stipa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e71cdd27e54722ed384abca34ca3478d671839ccf026abc8f42378791b1b20a
|
|
4
|
+
data.tar.gz: 1ba6eb20c650ab6a2f092334c6831a6d4ea4bcbf0c92305b85ebebcd483add53
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8452941f67b0cfdda3345059dc0da6d21d5ef50275028d633da2bcdd0c80cf37ff159a0516b11e2737470f1758e37ba7b83be9ff78707340e2bedff2b3e2494
|
|
7
|
+
data.tar.gz: 1f16b15656290daa904eefaf5953353d5874de701b529831b40d00111c49d2cf88f294b8e1be061806657c502030e333e056283f477118d772b9d444c6f40ca9
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.6] - 2026-03-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Colon-segment route patterns** — string routes now accept `:param` placeholders
|
|
13
|
+
(e.g. `'/users/:id'`, `'/admin/users/:id'`). Segments are converted to anchored
|
|
14
|
+
named-capture Regexps at match time; captured values are available via `req.params`.
|
|
15
|
+
- **Namespaced controller resolution** — `to:` values such as `'admin/users#update'`
|
|
16
|
+
are now resolved to `Admin::UsersController#update`. Slash separators become `::` and
|
|
17
|
+
each segment is camel-cased independently (snake_case preserved).
|
|
18
|
+
|
|
8
19
|
## [0.1.5] - 2026-03-20
|
|
9
20
|
|
|
10
21
|
### Added
|
data/lib/stipa/app.rb
CHANGED
|
@@ -95,8 +95,14 @@ module Stipa
|
|
|
95
95
|
|
|
96
96
|
match = case pattern
|
|
97
97
|
when String
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
if pattern.include?(':')
|
|
99
|
+
# Colon-segment pattern: /users/:id → named-capture Regexp
|
|
100
|
+
re = pattern.gsub(%r{:([a-zA-Z_][a-zA-Z0-9_]*)}) { "(?<#{Regexp.last_match(1)}>[^/]+)" }
|
|
101
|
+
Regexp.new("\\A#{re}\\z").match(req.path)
|
|
102
|
+
else
|
|
103
|
+
# Exact string match
|
|
104
|
+
req.path == pattern ? true : nil
|
|
105
|
+
end
|
|
100
106
|
when Regexp
|
|
101
107
|
# Full Regexp match — named captures become req.params
|
|
102
108
|
pattern.match(req.path)
|
|
@@ -132,7 +132,10 @@ module Stipa
|
|
|
132
132
|
|
|
133
133
|
def resolve(to)
|
|
134
134
|
ctrl, action = to.split('#', 2)
|
|
135
|
-
|
|
135
|
+
# 'admin/users' → 'Admin::UsersController'
|
|
136
|
+
# 'users' → 'UsersController'
|
|
137
|
+
class_name = ctrl.split('/').map { |seg| seg.split('_').map(&:capitalize).join }.join('::') + 'Controller'
|
|
138
|
+
klass = Object.const_get(class_name)
|
|
136
139
|
[klass, action.to_sym]
|
|
137
140
|
end
|
|
138
141
|
|
data/lib/stipa/version.rb
CHANGED