padrino-core 0.15.0 → 0.15.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/lib/padrino-core/application.rb +4 -1
- data/lib/padrino-core/logger.rb +11 -2
- data/lib/padrino-core/path_router.rb +3 -1
- data/lib/padrino-core/version.rb +1 -1
- data/padrino-core.gemspec +2 -2
- data/test/test_application.rb +1 -1
- data/test/test_routing.rb +13 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936bbc8899b2e4f9d72e9bc438d3a645c7caa27d90a87a3076bf612ce2081266
|
4
|
+
data.tar.gz: 391dd038f7b3c928bb141bbdf583a5e01b9b9a08528c05cc957378369cb6cc35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a09f99b3330e75cf04caea5b69beae228fe9f65b7254ba292e3327c9620b6bf9806fd2a7ca1059890f53c4e653a76835ecc826e1a4dd9d185446686f8ad628
|
7
|
+
data.tar.gz: 6ea735209558b4f7579ebde9004437b980e61af0e77cc898bad8d331d13f31c93a477e3c18e54158dd3a447600b0cbd05deb769c22b6b2af911bc5e88e4183e4
|
@@ -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
|
#
|
data/lib/padrino-core/logger.rb
CHANGED
@@ -22,19 +22,28 @@ module Padrino
|
|
22
22
|
# Set the padrino logger.
|
23
23
|
#
|
24
24
|
# @param [Object] value
|
25
|
-
# an object that respond to <<, write, puts, debug, warn etc..
|
25
|
+
# an object that respond to <<, write, puts, debug, warn, devel, etc..
|
26
26
|
#
|
27
27
|
# @return [Object]
|
28
28
|
# The given value.
|
29
29
|
#
|
30
30
|
# @example using ruby default logger
|
31
31
|
# require 'logger'
|
32
|
-
#
|
32
|
+
# new_logger = ::Logger.new(STDOUT)
|
33
|
+
# new_logger.extend(Padrino::Logger::Extensions)
|
34
|
+
# Padrino.logger = new_logger
|
33
35
|
#
|
34
36
|
# @example using ActiveSupport
|
35
37
|
# require 'active_support/buffered_logger'
|
36
38
|
# Padrino.logger = Buffered.new(STDOUT)
|
37
39
|
#
|
40
|
+
# @example using custom logger class
|
41
|
+
# require 'logger'
|
42
|
+
# class CustomLogger < ::Logger
|
43
|
+
# include Padrino::Logger::Extensions
|
44
|
+
# end
|
45
|
+
# Padrino.logger = CustomLogger.new(STDOUT)
|
46
|
+
#
|
38
47
|
def self.logger=(value)
|
39
48
|
Padrino::Logger.logger = value
|
40
49
|
end
|
@@ -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
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.rdoc_options = ["--charset=UTF-8"]
|
24
24
|
|
25
25
|
s.add_dependency("padrino-support", Padrino.version)
|
26
|
-
s.add_dependency("sinatra", ">= 2.
|
27
|
-
s.add_dependency("thor", "~> 0
|
26
|
+
s.add_dependency("sinatra", ">= 2.2.4")
|
27
|
+
s.add_dependency("thor", "~> 1.0")
|
28
28
|
end
|
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,17 +1,17 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
8
8
|
- Nathan Esquenazi
|
9
9
|
- Davide D'Agostino
|
10
10
|
- Arthur Chiu
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-12-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,42 +19,42 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.15.
|
22
|
+
version: 0.15.2
|
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.2
|
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
|
47
47
|
requirements:
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '0
|
50
|
+
version: '1.0'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0
|
57
|
+
version: '1.0'
|
58
58
|
description: The Padrino core gem required for use of this framework
|
59
59
|
email: padrinorb@gmail.com
|
60
60
|
executables:
|
@@ -191,7 +191,7 @@ homepage: http://www.padrinorb.com
|
|
191
191
|
licenses:
|
192
192
|
- MIT
|
193
193
|
metadata: {}
|
194
|
-
post_install_message:
|
194
|
+
post_install_message:
|
195
195
|
rdoc_options:
|
196
196
|
- "--charset=UTF-8"
|
197
197
|
require_paths:
|
@@ -207,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 1.3.6
|
209
209
|
requirements: []
|
210
|
-
rubygems_version: 3.0.
|
211
|
-
signing_key:
|
210
|
+
rubygems_version: 3.0.8
|
211
|
+
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: The required Padrino core gem
|
214
214
|
test_files:
|