http_router 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/ext/rack/rack_mapper.rb +57 -0
- data/lib/ext/rack/uri_escape.rb +26 -0
- data/lib/http_router/glob.rb +2 -1
- data/lib/http_router/{sinatra.rb → interface/sinatra.rb} +7 -7
- data/lib/http_router/node.rb +109 -59
- data/lib/http_router/path.rb +23 -2
- data/lib/http_router/response.rb +36 -15
- data/lib/http_router/root.rb +12 -63
- data/lib/http_router/route.rb +74 -24
- data/lib/http_router/variable.rb +16 -9
- data/lib/http_router.rb +55 -31
- data/spec/generate_spec.rb +81 -12
- data/spec/misc_spec.rb +38 -0
- data/spec/rack/dispatch_spec.rb +2 -2
- data/spec/rack/generate_spec.rb +1 -1
- data/spec/recognize_spec.rb +25 -2
- data/spec/sinatra/recognize_spec.rb +2 -2
- metadata +14 -6
- data/lib/rack/uri_escape.rb +0 -38
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Joshua Hull
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-30 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -30,17 +31,19 @@ files:
|
|
30
31
|
- README.rdoc
|
31
32
|
- Rakefile
|
32
33
|
- VERSION
|
34
|
+
- lib/ext/rack/rack_mapper.rb
|
35
|
+
- lib/ext/rack/uri_escape.rb
|
33
36
|
- lib/http_router.rb
|
34
37
|
- lib/http_router/glob.rb
|
38
|
+
- lib/http_router/interface/sinatra.rb
|
35
39
|
- lib/http_router/node.rb
|
36
40
|
- lib/http_router/path.rb
|
37
41
|
- lib/http_router/response.rb
|
38
42
|
- lib/http_router/root.rb
|
39
43
|
- lib/http_router/route.rb
|
40
|
-
- lib/http_router/sinatra.rb
|
41
44
|
- lib/http_router/variable.rb
|
42
|
-
- lib/rack/uri_escape.rb
|
43
45
|
- spec/generate_spec.rb
|
46
|
+
- spec/misc_spec.rb
|
44
47
|
- spec/rack/dispatch_spec.rb
|
45
48
|
- spec/rack/generate_spec.rb
|
46
49
|
- spec/rack/route_spec.rb
|
@@ -58,28 +61,33 @@ rdoc_options:
|
|
58
61
|
require_paths:
|
59
62
|
- lib
|
60
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
61
65
|
requirements:
|
62
66
|
- - ">="
|
63
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
64
69
|
segments:
|
65
70
|
- 0
|
66
71
|
version: "0"
|
67
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
68
74
|
requirements:
|
69
75
|
- - ">="
|
70
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
71
78
|
segments:
|
72
79
|
- 0
|
73
80
|
version: "0"
|
74
81
|
requirements: []
|
75
82
|
|
76
83
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.3.
|
84
|
+
rubygems_version: 1.3.7
|
78
85
|
signing_key:
|
79
86
|
specification_version: 3
|
80
87
|
summary: A kick-ass HTTP router for use in Rack & Sinatra
|
81
88
|
test_files:
|
82
89
|
- spec/generate_spec.rb
|
90
|
+
- spec/misc_spec.rb
|
83
91
|
- spec/rack/dispatch_spec.rb
|
84
92
|
- spec/rack/generate_spec.rb
|
85
93
|
- spec/rack/route_spec.rb
|
data/lib/rack/uri_escape.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
unless Rack::Utils.respond_to?(:uri_escape)
|
2
|
-
module Rack
|
3
|
-
module Utils
|
4
|
-
def uri_escape(s)
|
5
|
-
s.to_s.gsub(/([^:\/?\[\]\-_~\.!\$&'\(\)\*\+,;=@a-zA-Z0-9]+)/n) {
|
6
|
-
'%'<<$1.unpack('H2'*$1.size).join('%').upcase
|
7
|
-
}
|
8
|
-
end
|
9
|
-
module_function :uri_escape
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
unless Rack::Utils.respond_to?(:uri_escape!)
|
15
|
-
module Rack
|
16
|
-
module Utils
|
17
|
-
def uri_escape!(s)
|
18
|
-
s.to_s.gsub!(/([^:\/?\[\]\-_~\.!\$&'\(\)\*\+,;=@a-zA-Z0-9]+)/n) {
|
19
|
-
'%'<<$1.unpack('H2'*$1.size).join('%').upcase
|
20
|
-
}
|
21
|
-
end
|
22
|
-
module_function :uri_escape!
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
unless Rack::Utils.respond_to?(:uri_unescape)
|
28
|
-
module Rack
|
29
|
-
module Utils
|
30
|
-
def uri_unescape(s)
|
31
|
-
gsub(/((?:%[0-9a-fA-F]{2})+)/n){
|
32
|
-
[$1.delete('%')].pack('H*')
|
33
|
-
}
|
34
|
-
end
|
35
|
-
module_function :uri_unescape
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|