pendragon 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89f0b037692dd728f51329a2cc4df730582d0480
4
- data.tar.gz: 20859c54d93fa69ff145d11d052600b60245ffd9
3
+ metadata.gz: 914465eff1ee8117a07da6fd8f8e9619885003d2
4
+ data.tar.gz: dec0c29b856f107c142018b068e978012de160c9
5
5
  SHA512:
6
- metadata.gz: e7226f8f044f7310cd4de904661c2cfeda0ac66169d691363f905718498db5cae9f44bf4d857f585a1c4547d9b1de8356763ef6e5414245724f4e4a2031063a7
7
- data.tar.gz: 80b0c5acd5492211707c5e7c3fd5f0bb3b3fba6adadd5863e641dca640ca544752e5ff7fdfa97ad87a5de58a292f68c7dc3c048bdc3090a8e61dae5e1d524678
6
+ metadata.gz: 9defb1e67cef1b199bc9b556467a17c56e9fa94a97421a5fbcc6b519fd9039d4ba55e9f9d02f7c2bb4ead6a1cb954e12052fbc59c7697b5a59db52e72691da68
7
+ data.tar.gz: 97473aaab4ccbfbbc7e8ab6147935107c45fd9852463abe53a8285f3e1bbccc32163298fee0c6e97060aa0377d67f42d80f428585a1f8b14dc9df874cddfb699
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ install:
6
6
  rvm:
7
7
  - 2.0.0
8
8
  - 2.1.0
9
- - jruby-head
9
+ - jruby
10
10
  - rbx
11
11
  notifications:
12
12
  recipients:
@@ -17,4 +17,4 @@ branches:
17
17
  matrix:
18
18
  allow_failures:
19
19
  - rvm: rbx
20
- - rvm: jruby-head
20
+ - rvm: jruby
data/Gemfile.lock CHANGED
@@ -1,19 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pendragon (0.6.0)
5
- mustermann (= 0.2.0)
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.5)
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.0)
31
+ minitest (5.4.2)
30
32
  mocha (1.1.0)
31
33
  metaclass (~> 0.0.1)
32
34
  moneta (0.7.20)
33
- mustermann (0.2.0)
34
- padrino (0.12.3)
35
- padrino-admin (= 0.12.3)
36
- padrino-cache (= 0.12.3)
37
- padrino-core (= 0.12.3)
38
- padrino-gen (= 0.12.3)
39
- padrino-helpers (= 0.12.3)
40
- padrino-mailer (= 0.12.3)
41
- padrino-support (= 0.12.3)
42
- padrino-admin (0.12.3)
43
- padrino-core (= 0.12.3)
44
- padrino-helpers (= 0.12.3)
45
- padrino-cache (0.12.3)
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.3)
48
- padrino-helpers (= 0.12.3)
49
- padrino-core (0.12.3)
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.3)
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.3)
59
+ padrino-gen (0.12.4)
57
60
  bundler (~> 1.0)
58
- padrino-core (= 0.12.3)
59
- padrino-helpers (0.12.3)
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.3)
64
+ padrino-support (= 0.12.4)
62
65
  tilt (~> 1.4.1)
63
- padrino-mailer (0.12.3)
66
+ padrino-mailer (0.12.4)
64
67
  mail (~> 2.5.3)
65
- padrino-core (= 0.12.3)
66
- padrino-support (0.12.3)
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("_#{route.index}") }
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
@@ -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
- pattern = pattern[0..-2] if mustermann? and pattern != PATH_DELIMITER and pattern.end_with?(PATH_DELIMITER)
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
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Pendragon
3
- VERSION = '0.6.1'
3
+ VERSION = '0.6.2'
4
4
  end
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 "mustermann", "= 0.2.0"
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
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require File.expand_path('../../lib/pendragon/padrino', __FILE__)
2
3
  $:.unshift(File.dirname(__FILE__))
3
4
  require 'active_support/core_ext/hash/conversions'
@@ -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.1
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-08-23 00:00:00.000000000 Z
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: mustermann
28
+ name: mustermann19
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.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.2.0
40
+ version: 0.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement