lotus-router 0.4.1 → 0.4.2
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 +5 -0
- data/lib/lotus/router/version.rb +1 -1
- data/lib/lotus/routing/http_router.rb +15 -65
- data/lotus-router.gemspec +3 -3
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7a9c9761153f8eddd68faf42de96a0f24b2322b
|
4
|
+
data.tar.gz: 1a061c973e8f66fd70c9ec729fdb5b57b0e62b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4acb5fb5676f9ed4bcebf05654aef397a93ddefae101f3e5a10688a9c2b35bdcae343ba29205d0e522b397a83ad37455465dbe84d2f6ca24c842436e74e85eeb
|
7
|
+
data.tar.gz: 410e13279ef4ea18b8e43189c5e70fcc42dda2c3dc6730846f721d5fda07673a91676292bd88af02cd6f34ee43fd9a1d5d52709f3ce8c2b2178c1c6068a93425
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Lotus::Router
|
2
2
|
Rack compatible HTTP router for Ruby
|
3
3
|
|
4
|
+
## v0.4.2 - 2015-07-10
|
5
|
+
### Fixed
|
6
|
+
- [Alfonso Uceda Pompa] Ensure mounted applications to not repeat their prefix (eg `/admin/admin`)
|
7
|
+
- [Thiago Felippe] Ensure router inspector properly prints routes with repeated entries (eg `/admin/dashboard/admin`)
|
8
|
+
|
4
9
|
## v0.4.1 - 2015-06-23
|
5
10
|
### Added
|
6
11
|
- [Alfonso Uceda Pompa] Force SSL (eg `Lotus::Router.new(force_ssl: true`).
|
data/lib/lotus/router/version.rb
CHANGED
@@ -75,8 +75,10 @@ module Lotus
|
|
75
75
|
#
|
76
76
|
# @since 0.1.0
|
77
77
|
# @api private
|
78
|
-
def
|
79
|
-
_rescue_url_recognition
|
78
|
+
def raw_path(route, *args)
|
79
|
+
_rescue_url_recognition do
|
80
|
+
_custom_path(super(route, *args))
|
81
|
+
end
|
80
82
|
end
|
81
83
|
|
82
84
|
# Generate an absolute URL for a specified named route.
|
@@ -85,68 +87,10 @@ module Lotus
|
|
85
87
|
#
|
86
88
|
# @since 0.1.0
|
87
89
|
# @api private
|
88
|
-
def
|
89
|
-
_rescue_url_recognition
|
90
|
-
|
91
|
-
|
92
|
-
# Support for GET HTTP verb
|
93
|
-
#
|
94
|
-
# @see Lotus::Router#options
|
95
|
-
#
|
96
|
-
# @since 0.4.1
|
97
|
-
# @api private
|
98
|
-
def get(path, options = {}, &blk)
|
99
|
-
super(@prefix.join(path), options, &blk)
|
100
|
-
end
|
101
|
-
|
102
|
-
# Support for POST HTTP verb
|
103
|
-
#
|
104
|
-
# @see Lotus::Router#post
|
105
|
-
#
|
106
|
-
# @since 0.4.1
|
107
|
-
# @api private
|
108
|
-
def post(path, options = {}, &blk)
|
109
|
-
super(@prefix.join(path), options, &blk)
|
110
|
-
end
|
111
|
-
|
112
|
-
# Support for PUT HTTP verb
|
113
|
-
#
|
114
|
-
# @see Lotus::Router#put
|
115
|
-
#
|
116
|
-
# @since 0.4.1
|
117
|
-
# @api private
|
118
|
-
def put(path, options = {}, &blk)
|
119
|
-
super(@prefix.join(path), options, &blk)
|
120
|
-
end
|
121
|
-
|
122
|
-
# Support for PATCH HTTP verb
|
123
|
-
#
|
124
|
-
# @see Lotus::Router#patch
|
125
|
-
#
|
126
|
-
# @since 0.4.1
|
127
|
-
# @api private
|
128
|
-
def patch(path, options = {}, &blk)
|
129
|
-
super(@prefix.join(path), options, &blk)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Support for DELETE HTTP verb
|
133
|
-
#
|
134
|
-
# @see Lotus::Router#delete
|
135
|
-
#
|
136
|
-
# @since 0.4.1
|
137
|
-
# @api private
|
138
|
-
def delete(path, options = {}, &blk)
|
139
|
-
super(@prefix.join(path), options, &blk)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Support for TRACE HTTP verb
|
143
|
-
#
|
144
|
-
# @see Lotus::Router#trace
|
145
|
-
#
|
146
|
-
# @since 0.4.1
|
147
|
-
# @api private
|
148
|
-
def trace(path, options = {}, &blk)
|
149
|
-
super(@prefix.join(path), options, &blk)
|
90
|
+
def raw_url(route, *args)
|
91
|
+
_rescue_url_recognition do
|
92
|
+
_custom_path(super(route, *args))
|
93
|
+
end
|
150
94
|
end
|
151
95
|
|
152
96
|
# Support for OPTIONS HTTP verb
|
@@ -156,7 +100,7 @@ module Lotus
|
|
156
100
|
# @since 0.1.0
|
157
101
|
# @api private
|
158
102
|
def options(path, options = {}, &blk)
|
159
|
-
add_with_request_method(
|
103
|
+
add_with_request_method(path, :options, options, &blk)
|
160
104
|
end
|
161
105
|
|
162
106
|
# Allow to mount a Rack app
|
@@ -212,6 +156,12 @@ module Lotus
|
|
212
156
|
::HttpRouter::TooManyParametersException => e
|
213
157
|
raise Routing::InvalidRouteException.new(e.message)
|
214
158
|
end
|
159
|
+
|
160
|
+
def _custom_path(uri_string)
|
161
|
+
uri = URI.parse(uri_string)
|
162
|
+
uri.path = @prefix.join(uri.path)
|
163
|
+
uri.to_s
|
164
|
+
end
|
215
165
|
end
|
216
166
|
end
|
217
167
|
end
|
data/lotus-router.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'lotus/router/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'lotus-router'
|
8
8
|
spec.version = Lotus::Router::VERSION
|
9
|
-
spec.authors = ['Luca Guidi']
|
10
|
-
spec.email = ['me@lucaguidi.com']
|
9
|
+
spec.authors = ['Luca Guidi', 'Trung Lê', 'Alfonso Uceda Pompa']
|
10
|
+
spec.email = ['me@lucaguidi.com', 'trung.le@ruby-journal.com', 'uceda73@gmail.com']
|
11
11
|
spec.description = %q{Rack compatible HTTP router for Ruby}
|
12
12
|
spec.summary = %q{Rack compatible HTTP router for Ruby and Lotus}
|
13
13
|
spec.homepage = 'http://lotusrb.org'
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.required_ruby_version = '>= 2.0.0'
|
21
21
|
|
22
22
|
spec.add_dependency 'http_router', '~> 0.11'
|
23
|
-
spec.add_dependency 'lotus-utils', '~> 0.5'
|
23
|
+
spec.add_dependency 'lotus-utils', '~> 0.5', '>= 0.5.1'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
26
26
|
spec.add_development_dependency 'minitest', '~> 5'
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotus-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
+
- Trung Lê
|
9
|
+
- Alfonso Uceda Pompa
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date: 2015-
|
13
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: http_router
|
@@ -31,6 +33,9 @@ dependencies:
|
|
31
33
|
- - "~>"
|
32
34
|
- !ruby/object:Gem::Version
|
33
35
|
version: '0.5'
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.5.1
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,6 +43,9 @@ dependencies:
|
|
38
43
|
- - "~>"
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0.5'
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.5.1
|
41
49
|
- !ruby/object:Gem::Dependency
|
42
50
|
name: bundler
|
43
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +91,8 @@ dependencies:
|
|
83
91
|
description: Rack compatible HTTP router for Ruby
|
84
92
|
email:
|
85
93
|
- me@lucaguidi.com
|
94
|
+
- trung.le@ruby-journal.com
|
95
|
+
- uceda73@gmail.com
|
86
96
|
executables: []
|
87
97
|
extensions: []
|
88
98
|
extra_rdoc_files: []
|