pendragon 0.6.1 → 0.6.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/.travis.yml +2 -2
- data/Gemfile.lock +33 -28
- data/lib/pendragon/engine/compiler.rb +2 -1
- data/lib/pendragon/engine/recognizer.rb +1 -0
- data/lib/pendragon/matcher.rb +3 -1
- data/lib/pendragon/version.rb +1 -1
- data/pendragon.gemspec +1 -1
- data/test/padrino_test.rb +1 -0
- data/test/pendragon_test.rb +22 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 914465eff1ee8117a07da6fd8f8e9619885003d2
|
4
|
+
data.tar.gz: dec0c29b856f107c142018b068e978012de160c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9defb1e67cef1b199bc9b556467a17c56e9fa94a97421a5fbcc6b519fd9039d4ba55e9f9d02f7c2bb4ead6a1cb954e12052fbc59c7697b5a59db52e72691da68
|
7
|
+
data.tar.gz: 97473aaab4ccbfbbc7e8ab6147935107c45fd9852463abe53a8285f3e1bbccc32163298fee0c6e97060aa0377d67f42d80f428585a1f8b14dc9df874cddfb699
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pendragon (0.6.
|
5
|
-
|
4
|
+
pendragon (0.6.1)
|
5
|
+
mustermann19 (~> 0.3.0)
|
6
6
|
rack (>= 1.3.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (4.1.
|
11
|
+
activesupport (4.1.6)
|
12
12
|
i18n (~> 0.6, >= 0.6.9)
|
13
13
|
json (~> 1.7, >= 1.7.7)
|
14
14
|
minitest (~> 5.1)
|
15
15
|
thread_safe (~> 0.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
+
enumerable-lazy (0.0.1)
|
17
18
|
haml (4.0.5)
|
18
19
|
tilt
|
19
20
|
http_router (0.11.1)
|
@@ -21,49 +22,51 @@ GEM
|
|
21
22
|
url_mount (~> 0.2.1)
|
22
23
|
i18n (0.6.11)
|
23
24
|
json (1.8.1)
|
25
|
+
json (1.8.1-java)
|
24
26
|
mail (2.5.4)
|
25
27
|
mime-types (~> 1.16)
|
26
28
|
treetop (~> 1.4.8)
|
27
29
|
metaclass (0.0.4)
|
28
30
|
mime-types (1.25.1)
|
29
|
-
minitest (5.4.
|
31
|
+
minitest (5.4.2)
|
30
32
|
mocha (1.1.0)
|
31
33
|
metaclass (~> 0.0.1)
|
32
34
|
moneta (0.7.20)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
padrino-
|
37
|
-
padrino-
|
38
|
-
padrino-
|
39
|
-
padrino-
|
40
|
-
padrino-
|
41
|
-
padrino-
|
42
|
-
|
43
|
-
|
44
|
-
padrino-
|
45
|
-
|
35
|
+
mustermann19 (0.3.1)
|
36
|
+
enumerable-lazy
|
37
|
+
padrino (0.12.4)
|
38
|
+
padrino-admin (= 0.12.4)
|
39
|
+
padrino-cache (= 0.12.4)
|
40
|
+
padrino-core (= 0.12.4)
|
41
|
+
padrino-gen (= 0.12.4)
|
42
|
+
padrino-helpers (= 0.12.4)
|
43
|
+
padrino-mailer (= 0.12.4)
|
44
|
+
padrino-support (= 0.12.4)
|
45
|
+
padrino-admin (0.12.4)
|
46
|
+
padrino-core (= 0.12.4)
|
47
|
+
padrino-helpers (= 0.12.4)
|
48
|
+
padrino-cache (0.12.4)
|
46
49
|
moneta (~> 0.7.0)
|
47
|
-
padrino-core (= 0.12.
|
48
|
-
padrino-helpers (= 0.12.
|
49
|
-
padrino-core (0.12.
|
50
|
+
padrino-core (= 0.12.4)
|
51
|
+
padrino-helpers (= 0.12.4)
|
52
|
+
padrino-core (0.12.4)
|
50
53
|
activesupport (>= 3.1)
|
51
54
|
http_router (~> 0.11.0)
|
52
|
-
padrino-support (= 0.12.
|
55
|
+
padrino-support (= 0.12.4)
|
53
56
|
rack-protection (>= 1.5.0)
|
54
57
|
sinatra (~> 1.4.2)
|
55
58
|
thor (~> 0.18)
|
56
|
-
padrino-gen (0.12.
|
59
|
+
padrino-gen (0.12.4)
|
57
60
|
bundler (~> 1.0)
|
58
|
-
padrino-core (= 0.12.
|
59
|
-
padrino-helpers (0.12.
|
61
|
+
padrino-core (= 0.12.4)
|
62
|
+
padrino-helpers (0.12.4)
|
60
63
|
i18n (~> 0.6, >= 0.6.7)
|
61
|
-
padrino-support (= 0.12.
|
64
|
+
padrino-support (= 0.12.4)
|
62
65
|
tilt (~> 1.4.1)
|
63
|
-
padrino-mailer (0.12.
|
66
|
+
padrino-mailer (0.12.4)
|
64
67
|
mail (~> 2.5.3)
|
65
|
-
padrino-core (= 0.12.
|
66
|
-
padrino-support (0.12.
|
68
|
+
padrino-core (= 0.12.4)
|
69
|
+
padrino-support (0.12.4)
|
67
70
|
activesupport (>= 3.1)
|
68
71
|
polyglot (0.3.5)
|
69
72
|
rack (1.5.2)
|
@@ -78,6 +81,7 @@ GEM
|
|
78
81
|
tilt (~> 1.3, >= 1.3.4)
|
79
82
|
thor (0.19.1)
|
80
83
|
thread_safe (0.3.4)
|
84
|
+
thread_safe (0.3.4-java)
|
81
85
|
tilt (1.4.1)
|
82
86
|
treetop (1.4.15)
|
83
87
|
polyglot
|
@@ -88,6 +92,7 @@ GEM
|
|
88
92
|
rack
|
89
93
|
|
90
94
|
PLATFORMS
|
95
|
+
java
|
91
96
|
ruby
|
92
97
|
|
93
98
|
DEPENDENCIES
|
@@ -21,6 +21,7 @@ module Pendragon
|
|
21
21
|
def call(request)
|
22
22
|
compile! unless compiled?
|
23
23
|
pattern, verb, params = parse_request(request)
|
24
|
+
pattern = pattern.encode(Encoding.default_external)
|
24
25
|
raise_exception(400) unless valid_verb?(verb)
|
25
26
|
candidacies = match_with(pattern)
|
26
27
|
raise_exception(404) if candidacies.empty?
|
@@ -62,7 +63,7 @@ module Pendragon
|
|
62
63
|
conditions << pattern[0..-2] if pattern != Matcher::PATH_DELIMITER && pattern.end_with?(Matcher::PATH_DELIMITER)
|
63
64
|
loop.with_object([]) do |_, candidacies|
|
64
65
|
return candidacies unless conditions.any?{|x| @regexps[offset] === x }
|
65
|
-
route = @routes[offset..-1].detect{|route| Regexp.last_match
|
66
|
+
route = @routes[offset..-1].detect{|route| Regexp.last_match["_#{route.index}"] }
|
66
67
|
candidacies << route
|
67
68
|
offset = route.index + 1
|
68
69
|
end
|
@@ -20,6 +20,7 @@ module Pendragon
|
|
20
20
|
# @return [Array] The return value will be something like [Pendragon::Route, Hash]
|
21
21
|
def call(request)
|
22
22
|
pattern, verb, params = parse_request(request)
|
23
|
+
pattern = pattern.encode(Encoding.default_external)
|
23
24
|
raise_exception(400) unless valid_verb?(verb)
|
24
25
|
fetch(pattern, verb){|route| [route, params_for(route, pattern, params)] }
|
25
26
|
end
|
data/lib/pendragon/matcher.rb
CHANGED
@@ -34,7 +34,9 @@ module Pendragon
|
|
34
34
|
# @return [MatchData] If the pattern matched this route, return a MatchData.
|
35
35
|
# @return [Nil] If the pattern doesn't matched this route, return a nil.
|
36
36
|
def match(pattern)
|
37
|
-
|
37
|
+
match_data = handler.match(pattern)
|
38
|
+
return match_data if match_data
|
39
|
+
pattern = pattern[0..-2] if mustermann? && pattern != PATH_DELIMITER && pattern.end_with?(PATH_DELIMITER)
|
38
40
|
handler.match(pattern)
|
39
41
|
end
|
40
42
|
|
data/lib/pendragon/version.rb
CHANGED
data/pendragon.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new "pendragon", Pendragon::VERSION do |s|
|
|
11
11
|
s.license = "MIT"
|
12
12
|
|
13
13
|
s.add_dependency "rack", ">= 1.3.0"
|
14
|
-
s.add_dependency "
|
14
|
+
s.add_dependency "mustermann19", "~> 0.3.0"
|
15
15
|
s.add_development_dependency "rake", ">= 0.8.7"
|
16
16
|
s.add_development_dependency "rack-test", ">= 0.5.0"
|
17
17
|
s.add_development_dependency "mocha", ">= 0.10.0"
|
data/test/padrino_test.rb
CHANGED
data/test/pendragon_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require File.expand_path('../../lib/pendragon', __FILE__)
|
2
3
|
$:.unshift(File.dirname(__FILE__))
|
3
4
|
require 'helper'
|
@@ -99,6 +100,13 @@ describe Pendragon do
|
|
99
100
|
get "/"
|
100
101
|
assert_equal "yay", body
|
101
102
|
end
|
103
|
+
|
104
|
+
should "recognize the route if non-cut pattern is matched" do
|
105
|
+
@pendragon.get("/hey/"){ "say" }
|
106
|
+
@pendragon.get("/hey"){ "yay" }
|
107
|
+
get "/hey/"
|
108
|
+
assert_equal "say", body
|
109
|
+
end
|
102
110
|
end
|
103
111
|
|
104
112
|
describe "route options" do
|
@@ -196,6 +204,20 @@ describe Pendragon do
|
|
196
204
|
end
|
197
205
|
end
|
198
206
|
|
207
|
+
describe "splat" do
|
208
|
+
should "support splat pattern" do
|
209
|
+
@pendragon.get("/hey/*"){|s| "#{s[:splat][0]} splat!" }
|
210
|
+
get "/hey/hello"
|
211
|
+
assert_equal "hello splat!", body
|
212
|
+
end
|
213
|
+
|
214
|
+
should "support splat pattern including slash" do
|
215
|
+
@pendragon.get("/hey/*"){|s| "#{s[:splat][0]} splat!" }
|
216
|
+
get "/hey/hello/world"
|
217
|
+
assert_equal "hello/world splat!", body
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
199
221
|
describe "header" do
|
200
222
|
should "set Allow header when occur 405" do
|
201
223
|
@pendragon.get("/"){}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pendragon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- namusyaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: mustermann19
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|