stipa 0.1.5 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cae685e56a311306ac9de5e6590a97811aeb1037c37c16c8fc1678414853df71
4
- data.tar.gz: f5fe15523b603ec40905a278e78790b963498ee0aef45b3d431a16723a63493e
3
+ metadata.gz: 80e062eee66bb5fb015d00f45bb604c85ad905fbf35bbb32652ac48dbbc2b888
4
+ data.tar.gz: c2883dd7c9e9bf9025330d43ee0053bfb602841c47c12683df67497fe41a59f7
5
5
  SHA512:
6
- metadata.gz: 4eb79042d8771b8384f37191f0aa99ee5fc63a82b62fc0201be0d074b460c4d066484d6710b5fc659ec6ec0dd6a6be1d21bee6a97035f88155d3ff38a92f94bc
7
- data.tar.gz: 3db21d82f8e03e20d343fb65092f12bf5f92034dac1eb15289e702c1f23ca62e18e28d4222f091839b33903df077ad18454e9c4674d36374408224b2631ca6e7
6
+ metadata.gz: 2c434487c1186267976b98d73e3dfa9723babd352f46eacadaf0623045668e99e02972c12799c5123f11e35cc8855253ade8de05d6e913e958fde156138b67c2
7
+ data.tar.gz: feca4e22d0712c1fd927a828c49bed7e6696575fdb34cef8c2a73e013e50a2c7523c44a2a35c1a9ba12d416a1fe4cd4cf35b395b8d8ff5f77e1002ddb5c07359
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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Pedro Harbs
3
+ Copyright (c) 2025 Jānis Harbs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/lib/stipa/app.rb CHANGED
@@ -95,8 +95,14 @@ module Stipa
95
95
 
96
96
  match = case pattern
97
97
  when String
98
- # Exact string match
99
- req.path == pattern ? true : nil
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
- klass = Object.const_get(ctrl.split('_').map(&:capitalize).join + 'Controller')
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
@@ -1,3 +1,3 @@
1
1
  module Stipa
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stipa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
- - Pedro Harbs
7
+ - Jānis Harbs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-21 00:00:00.000000000 Z
11
+ date: 2026-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -79,7 +79,7 @@ description: |
79
79
  - Structured logging in logfmt format
80
80
  - Named route parameters via regex captures
81
81
  email:
82
- - harbspj@gmail.com
82
+ - janisharbs@inbox.lv
83
83
  executables:
84
84
  - stipa
85
85
  extensions: []
@@ -110,15 +110,15 @@ files:
110
110
  - lib/stipa/version.rb
111
111
  - media/favicon.ico
112
112
  - media/logo.png
113
- homepage: https://github.com/pedroharbs/stipa
113
+ homepage: https://github.com/janisharbs/stipa
114
114
  licenses:
115
115
  - MIT
116
116
  metadata:
117
- bug_tracker_uri: https://github.com/pedroharbs/stipa/issues
118
- changelog_uri: https://github.com/pedroharbs/stipa/releases
119
- documentation_uri: https://github.com/pedroharbs/stipa
120
- homepage_uri: https://github.com/pedroharbs/stipa
121
- source_code_uri: https://github.com/pedroharbs/stipa
117
+ bug_tracker_uri: https://github.com/janisharbs/stipa/issues
118
+ changelog_uri: https://github.com/janisharbs/stipa/releases
119
+ documentation_uri: https://github.com/janisharbs/stipa
120
+ homepage_uri: https://github.com/janisharbs/stipa
121
+ source_code_uri: https://github.com/janisharbs/stipa
122
122
  rubygems_mfa_required: 'true'
123
123
  post_install_message: "╔══════════════════════════════════════════════════════════════════════════╗\n║
124
124
  \ ║\n║ Welcome
@@ -128,7 +128,7 @@ post_install_message: "╔══════════════════
128
128
  stipa new my_app ║\n║ $ cd
129
129
  my_app && bundle install && npm install ║\n║ $ bundle
130
130
  exec ruby server.rb ║\n║ ║\n║
131
- \ Documentation: https://github.com/pedroharbs/stipa ║\n║ ║\n╚══════════════════════════════════════════════════════════════════════════╝\n"
131
+ \ Documentation: https://github.com/janisharbs/stipa ║\n║ ║\n╚══════════════════════════════════════════════════════════════════════════╝\n"
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.5.22
146
+ rubygems_version: 3.4.19
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Minimal, production-ready HTTP framework for Ruby