padrino-core 0.15.1 → 0.15.3
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/lib/padrino-core/application.rb +4 -1
- data/lib/padrino-core/path_router.rb +3 -1
- data/lib/padrino-core/version.rb +1 -1
- data/padrino-core.gemspec +1 -1
- data/test/test_application.rb +1 -1
- data/test/test_routing.rb +13 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7b0401b770a137f350c55ea76cc2edc52718927473c036e3fad135c2b8022ce
|
4
|
+
data.tar.gz: 0154f48a45c976b9bc672fc919d276b8e5826ab751e7640326ce9a5249a5aaa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10c221aa6fec0c7d6d3cf2aa0827c6d4701af14caf03cc24b40ec886ae38461d1b8a71b4ffafdda0975b3b8cf78f16e37d789a9d684aa17067f7f9720d09a737
|
7
|
+
data.tar.gz: 482ad64bee105627b9cb4600e1296cfc050a3fbb5813aa919c11ca26a4f09a36961ba288a0059f653edcd99a57ec2370a233bc78eef4b10a5f1e5572e572ffa3
|
@@ -29,13 +29,16 @@ module Padrino
|
|
29
29
|
class << self
|
30
30
|
def inherited(base)
|
31
31
|
begun_at = Time.now
|
32
|
-
CALLERS_TO_IGNORE.concat(PADRINO_IGNORE_CALLERS)
|
33
32
|
super(base)
|
34
33
|
base.prerequisites.replace(self.prerequisites.dup)
|
35
34
|
base.default_configuration!
|
36
35
|
logger.devel :setup, begun_at, base
|
37
36
|
end
|
38
37
|
|
38
|
+
def callers_to_ignore
|
39
|
+
@callers_to_ignore ||= super + PADRINO_IGNORE_CALLERS
|
40
|
+
end
|
41
|
+
|
39
42
|
##
|
40
43
|
# Reloads the application files from all defined load paths.
|
41
44
|
#
|
@@ -58,8 +58,10 @@ module Padrino
|
|
58
58
|
params = args.last.is_a?(Hash) ? args.pop : {}
|
59
59
|
candidates = @routes.select { |route| route.name == name }
|
60
60
|
fail InvalidRouteException if candidates.empty?
|
61
|
+
i = 0
|
61
62
|
route = candidates.sort_by! { |candidate|
|
62
|
-
|
63
|
+
# Tries to find the route that matches more, but with fewer names, in stable order
|
64
|
+
[(params.keys.map(&:to_s) - candidate.matcher.names).length, candidate.matcher.names.size, i += 1] }.shift
|
63
65
|
matcher = route.matcher
|
64
66
|
params_for_expand = params.dup
|
65
67
|
if !args.empty? && matcher.mustermann?
|
data/lib/padrino-core/version.rb
CHANGED
data/padrino-core.gemspec
CHANGED
data/test/test_application.rb
CHANGED
@@ -51,7 +51,7 @@ describe "Application" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should have shared sessions accessible in project' do
|
54
|
-
Padrino.configure_apps { enable :sessions; set :session_secret,
|
54
|
+
Padrino.configure_apps { enable :sessions; set :session_secret, PadrinoTestApp2.session_secret }
|
55
55
|
Padrino.mount("PadrinoTestApp").to("/write")
|
56
56
|
Padrino.mount("PadrinoTestApp2").to("/read")
|
57
57
|
PadrinoTestApp.send :default_configuration!
|
data/test/test_routing.rb
CHANGED
@@ -96,6 +96,17 @@ describe "Routing" do
|
|
96
96
|
assert_equal "/1234.json?baz=baz", @app.url_for(:index, :id => "1234", :format => "json", :baz => "baz")
|
97
97
|
end
|
98
98
|
|
99
|
+
it 'should recognize route even if paths are duplicated, in reverse order' do
|
100
|
+
mock_app do
|
101
|
+
get(:index, :with => :id, :provides => :json) {}
|
102
|
+
get(:index, :with => :id) {}
|
103
|
+
get(:index) {}
|
104
|
+
end
|
105
|
+
assert_equal "/", @app.url_for(:index)
|
106
|
+
assert_equal "/1234", @app.url_for(:index, :id => "1234")
|
107
|
+
assert_equal "/1234.json?baz=baz", @app.url_for(:index, :id => "1234", :format => "json", :baz => "baz")
|
108
|
+
end
|
109
|
+
|
99
110
|
it 'should fail with unrecognized route exception when not found' do
|
100
111
|
mock_app do
|
101
112
|
get(:index){ "okey" }
|
@@ -192,7 +203,7 @@ describe "Routing" do
|
|
192
203
|
mock_app do
|
193
204
|
get('/щч') { 'success!' }
|
194
205
|
end
|
195
|
-
get(
|
206
|
+
get('/' + CGI.escape('щч'))
|
196
207
|
assert_equal 'success!', body
|
197
208
|
end
|
198
209
|
|
@@ -2122,7 +2133,7 @@ describe "Routing" do
|
|
2122
2133
|
mock_app { set :environment, :development }
|
2123
2134
|
get "/"
|
2124
2135
|
assert_equal 404, status
|
2125
|
-
assert_match %r{
|
2136
|
+
assert_match %r{Not Found}, body
|
2126
2137
|
end
|
2127
2138
|
|
2128
2139
|
it 'should render a custom NotFound page' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-02-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,28 +19,28 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.15.
|
22
|
+
version: 0.15.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.15.
|
29
|
+
version: 0.15.3
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: sinatra
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 2.
|
36
|
+
version: 2.2.4
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.2.4
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: thor
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|