roda 1.1.0 → 1.2.0
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/CHANGELOG +70 -0
- data/README.rdoc +261 -302
- data/Rakefile +1 -1
- data/doc/release_notes/1.2.0.txt +406 -0
- data/lib/roda.rb +206 -124
- data/lib/roda/plugins/all_verbs.rb +11 -10
- data/lib/roda/plugins/assets.rb +5 -5
- data/lib/roda/plugins/backtracking_array.rb +12 -5
- data/lib/roda/plugins/caching.rb +10 -8
- data/lib/roda/plugins/class_level_routing.rb +94 -0
- data/lib/roda/plugins/content_for.rb +6 -0
- data/lib/roda/plugins/default_headers.rb +4 -11
- data/lib/roda/plugins/delay_build.rb +42 -0
- data/lib/roda/plugins/delegate.rb +64 -0
- data/lib/roda/plugins/drop_body.rb +33 -0
- data/lib/roda/plugins/empty_root.rb +48 -0
- data/lib/roda/plugins/environments.rb +68 -0
- data/lib/roda/plugins/error_email.rb +1 -2
- data/lib/roda/plugins/error_handler.rb +1 -1
- data/lib/roda/plugins/halt.rb +7 -5
- data/lib/roda/plugins/head.rb +4 -2
- data/lib/roda/plugins/header_matchers.rb +17 -9
- data/lib/roda/plugins/hooks.rb +16 -32
- data/lib/roda/plugins/json.rb +4 -10
- data/lib/roda/plugins/mailer.rb +233 -0
- data/lib/roda/plugins/match_affix.rb +48 -0
- data/lib/roda/plugins/multi_route.rb +9 -11
- data/lib/roda/plugins/multi_run.rb +81 -0
- data/lib/roda/plugins/named_templates.rb +93 -0
- data/lib/roda/plugins/not_allowed.rb +43 -48
- data/lib/roda/plugins/path.rb +63 -2
- data/lib/roda/plugins/render.rb +79 -48
- data/lib/roda/plugins/render_each.rb +6 -0
- data/lib/roda/plugins/sinatra_helpers.rb +523 -0
- data/lib/roda/plugins/slash_path_empty.rb +25 -0
- data/lib/roda/plugins/static_path_info.rb +64 -0
- data/lib/roda/plugins/streaming.rb +1 -1
- data/lib/roda/plugins/view_subdirs.rb +12 -8
- data/lib/roda/version.rb +1 -1
- data/spec/integration_spec.rb +33 -0
- data/spec/plugin/backtracking_array_spec.rb +24 -18
- data/spec/plugin/class_level_routing_spec.rb +138 -0
- data/spec/plugin/delay_build_spec.rb +23 -0
- data/spec/plugin/delegate_spec.rb +20 -0
- data/spec/plugin/drop_body_spec.rb +20 -0
- data/spec/plugin/empty_root_spec.rb +14 -0
- data/spec/plugin/environments_spec.rb +31 -0
- data/spec/plugin/h_spec.rb +1 -3
- data/spec/plugin/header_matchers_spec.rb +14 -0
- data/spec/plugin/hooks_spec.rb +3 -5
- data/spec/plugin/mailer_spec.rb +191 -0
- data/spec/plugin/match_affix_spec.rb +22 -0
- data/spec/plugin/multi_run_spec.rb +31 -0
- data/spec/plugin/named_templates_spec.rb +65 -0
- data/spec/plugin/path_spec.rb +66 -2
- data/spec/plugin/render_spec.rb +46 -1
- data/spec/plugin/sinatra_helpers_spec.rb +534 -0
- data/spec/plugin/slash_path_empty_spec.rb +22 -0
- data/spec/plugin/static_path_info_spec.rb +50 -0
- data/spec/request_spec.rb +23 -0
- data/spec/response_spec.rb +12 -1
- metadata +48 -6
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
describe "slash_path_empty" do
|
4
|
+
it "considers a / path as empty" do
|
5
|
+
app(:slash_path_empty) do |r|
|
6
|
+
r.is{"1"}
|
7
|
+
r.is("a"){"2"}
|
8
|
+
r.get("b"){"3"}
|
9
|
+
end
|
10
|
+
|
11
|
+
body("").should == '1'
|
12
|
+
body.should == '1'
|
13
|
+
body("a").should == ''
|
14
|
+
body("/a").should == '2'
|
15
|
+
body("/a/").should == '2'
|
16
|
+
body("/a/b").should == ''
|
17
|
+
body("b").should == ''
|
18
|
+
body("/b").should == '3'
|
19
|
+
body("/b/").should == '3'
|
20
|
+
body("/b/c").should == ''
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
describe "static_path_info plugin" do
|
4
|
+
it "does not modify SCRIPT_NAME/PATH_INFO during routing" do
|
5
|
+
app(:bare) do
|
6
|
+
plugin :static_path_info
|
7
|
+
plugin :pass
|
8
|
+
|
9
|
+
route do |r|
|
10
|
+
r.on "foo" do
|
11
|
+
r.is "bar" do
|
12
|
+
"bar|#{env['SCRIPT_NAME']}|#{env['PATH_INFO']}"
|
13
|
+
end
|
14
|
+
r.is "baz" do
|
15
|
+
r.pass
|
16
|
+
end
|
17
|
+
"foo|#{env['SCRIPT_NAME']}|#{env['PATH_INFO']}"
|
18
|
+
end
|
19
|
+
"#{env['SCRIPT_NAME']}|#{env['PATH_INFO']}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
body.should == '|/'
|
24
|
+
body('SCRIPT_NAME'=>'/a').should == '/a|/'
|
25
|
+
body('/foo').should == 'foo||/foo'
|
26
|
+
body('/foo', 'SCRIPT_NAME'=>'/a').should == 'foo|/a|/foo'
|
27
|
+
body('/foo/bar').should == 'bar||/foo/bar'
|
28
|
+
body('/foo/bar', 'SCRIPT_NAME'=>'/a').should == 'bar|/a|/foo/bar'
|
29
|
+
body('/foo/baz').should == 'foo||/foo/baz'
|
30
|
+
body('/foo/baz', 'SCRIPT_NAME'=>'/a').should == 'foo|/a|/foo/baz'
|
31
|
+
end
|
32
|
+
|
33
|
+
it "modifies SCRIPT_NAME/PATH_INFO when calling run" do
|
34
|
+
a = app{|r| "#{r.script_name}|#{r.path_info}"}
|
35
|
+
app(:static_path_info){|r| r.on("a"){r.run a}}
|
36
|
+
body("/a/b").should == "/a|/b"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "static_path_info request.path, .remaining_path, and .matched_path" do
|
41
|
+
it "should return the script name and path_info as a string" do
|
42
|
+
app(:static_path_info) do |r|
|
43
|
+
r.on "foo" do
|
44
|
+
"#{r.path}:#{r.matched_path}:#{r.remaining_path}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
body("/foo/bar").should == "/foo/bar:/foo:/bar"
|
49
|
+
end
|
50
|
+
end
|
data/spec/request_spec.rb
CHANGED
@@ -12,6 +12,18 @@ describe "request.full_path_info" do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
describe "request.path, .remaining_path, and .matched_path" do
|
16
|
+
it "should return the script name and path_info as a string" do
|
17
|
+
app do |r|
|
18
|
+
r.on "foo" do
|
19
|
+
"#{r.path}:#{r.matched_path}:#{r.remaining_path}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
body("/foo/bar").should == "/foo/bar:/foo:/bar"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
describe "request.halt" do
|
16
28
|
it "should return rack response as argument given it as argument" do
|
17
29
|
app do |r|
|
@@ -72,3 +84,14 @@ describe "TERM.inspect" do
|
|
72
84
|
body.should == "TERM"
|
73
85
|
end
|
74
86
|
end
|
87
|
+
|
88
|
+
describe "roda_class" do
|
89
|
+
it "should return the related roda subclass" do
|
90
|
+
app do |r|
|
91
|
+
self.class.opts[:a] = 'a'
|
92
|
+
r.class.roda_class.opts[:a] + r.roda_class.opts[:a]
|
93
|
+
end
|
94
|
+
|
95
|
+
body.should == "aa"
|
96
|
+
end
|
97
|
+
end
|
data/spec/response_spec.rb
CHANGED
@@ -173,6 +173,17 @@ describe "response #inspect" do
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
body.should == '#<Foo::RodaResponse 200 {
|
176
|
+
body.should == '#<Foo::RodaResponse 200 {} []>'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe "roda_class" do
|
181
|
+
it "should return the related roda subclass" do
|
182
|
+
app do |r|
|
183
|
+
self.class.opts[:a] = 'a'
|
184
|
+
response.class.roda_class.opts[:a] + response.roda_class.opts[:a]
|
185
|
+
end
|
186
|
+
|
187
|
+
body.should == "aa"
|
177
188
|
end
|
178
189
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -108,7 +108,21 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mail
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description:
|
112
126
|
email:
|
113
127
|
- code@jeremyevans.net
|
114
128
|
executables: []
|
@@ -120,6 +134,7 @@ extra_rdoc_files:
|
|
120
134
|
- doc/conventions.rdoc
|
121
135
|
- doc/release_notes/1.0.0.txt
|
122
136
|
- doc/release_notes/1.1.0.txt
|
137
|
+
- doc/release_notes/1.2.0.txt
|
123
138
|
files:
|
124
139
|
- CHANGELOG
|
125
140
|
- MIT-LICENSE
|
@@ -128,6 +143,7 @@ files:
|
|
128
143
|
- doc/conventions.rdoc
|
129
144
|
- doc/release_notes/1.0.0.txt
|
130
145
|
- doc/release_notes/1.1.0.txt
|
146
|
+
- doc/release_notes/1.2.0.txt
|
131
147
|
- lib/roda.rb
|
132
148
|
- lib/roda/plugins/_erubis_escaping.rb
|
133
149
|
- lib/roda/plugins/all_verbs.rb
|
@@ -135,9 +151,15 @@ files:
|
|
135
151
|
- lib/roda/plugins/backtracking_array.rb
|
136
152
|
- lib/roda/plugins/caching.rb
|
137
153
|
- lib/roda/plugins/chunked.rb
|
154
|
+
- lib/roda/plugins/class_level_routing.rb
|
138
155
|
- lib/roda/plugins/content_for.rb
|
139
156
|
- lib/roda/plugins/csrf.rb
|
140
157
|
- lib/roda/plugins/default_headers.rb
|
158
|
+
- lib/roda/plugins/delay_build.rb
|
159
|
+
- lib/roda/plugins/delegate.rb
|
160
|
+
- lib/roda/plugins/drop_body.rb
|
161
|
+
- lib/roda/plugins/empty_root.rb
|
162
|
+
- lib/roda/plugins/environments.rb
|
141
163
|
- lib/roda/plugins/error_email.rb
|
142
164
|
- lib/roda/plugins/error_handler.rb
|
143
165
|
- lib/roda/plugins/flash.rb
|
@@ -148,8 +170,12 @@ files:
|
|
148
170
|
- lib/roda/plugins/hooks.rb
|
149
171
|
- lib/roda/plugins/indifferent_params.rb
|
150
172
|
- lib/roda/plugins/json.rb
|
173
|
+
- lib/roda/plugins/mailer.rb
|
174
|
+
- lib/roda/plugins/match_affix.rb
|
151
175
|
- lib/roda/plugins/middleware.rb
|
152
176
|
- lib/roda/plugins/multi_route.rb
|
177
|
+
- lib/roda/plugins/multi_run.rb
|
178
|
+
- lib/roda/plugins/named_templates.rb
|
153
179
|
- lib/roda/plugins/not_allowed.rb
|
154
180
|
- lib/roda/plugins/not_found.rb
|
155
181
|
- lib/roda/plugins/pass.rb
|
@@ -157,6 +183,9 @@ files:
|
|
157
183
|
- lib/roda/plugins/per_thread_caching.rb
|
158
184
|
- lib/roda/plugins/render.rb
|
159
185
|
- lib/roda/plugins/render_each.rb
|
186
|
+
- lib/roda/plugins/sinatra_helpers.rb
|
187
|
+
- lib/roda/plugins/slash_path_empty.rb
|
188
|
+
- lib/roda/plugins/static_path_info.rb
|
160
189
|
- lib/roda/plugins/streaming.rb
|
161
190
|
- lib/roda/plugins/symbol_matchers.rb
|
162
191
|
- lib/roda/plugins/symbol_views.rb
|
@@ -178,9 +207,15 @@ files:
|
|
178
207
|
- spec/plugin/backtracking_array_spec.rb
|
179
208
|
- spec/plugin/caching_spec.rb
|
180
209
|
- spec/plugin/chunked_spec.rb
|
210
|
+
- spec/plugin/class_level_routing_spec.rb
|
181
211
|
- spec/plugin/content_for_spec.rb
|
182
212
|
- spec/plugin/csrf_spec.rb
|
183
213
|
- spec/plugin/default_headers_spec.rb
|
214
|
+
- spec/plugin/delay_build_spec.rb
|
215
|
+
- spec/plugin/delegate_spec.rb
|
216
|
+
- spec/plugin/drop_body_spec.rb
|
217
|
+
- spec/plugin/empty_root_spec.rb
|
218
|
+
- spec/plugin/environments_spec.rb
|
184
219
|
- spec/plugin/error_email_spec.rb
|
185
220
|
- spec/plugin/error_handler_spec.rb
|
186
221
|
- spec/plugin/flash_spec.rb
|
@@ -191,8 +226,12 @@ files:
|
|
191
226
|
- spec/plugin/hooks_spec.rb
|
192
227
|
- spec/plugin/indifferent_params_spec.rb
|
193
228
|
- spec/plugin/json_spec.rb
|
229
|
+
- spec/plugin/mailer_spec.rb
|
230
|
+
- spec/plugin/match_affix_spec.rb
|
194
231
|
- spec/plugin/middleware_spec.rb
|
195
232
|
- spec/plugin/multi_route_spec.rb
|
233
|
+
- spec/plugin/multi_run_spec.rb
|
234
|
+
- spec/plugin/named_templates_spec.rb
|
196
235
|
- spec/plugin/not_allowed_spec.rb
|
197
236
|
- spec/plugin/not_found_spec.rb
|
198
237
|
- spec/plugin/pass_spec.rb
|
@@ -200,6 +239,9 @@ files:
|
|
200
239
|
- spec/plugin/per_thread_caching_spec.rb
|
201
240
|
- spec/plugin/render_each_spec.rb
|
202
241
|
- spec/plugin/render_spec.rb
|
242
|
+
- spec/plugin/sinatra_helpers_spec.rb
|
243
|
+
- spec/plugin/slash_path_empty_spec.rb
|
244
|
+
- spec/plugin/static_path_info_spec.rb
|
203
245
|
- spec/plugin/streaming_spec.rb
|
204
246
|
- spec/plugin/symbol_matchers_spec.rb
|
205
247
|
- spec/plugin/symbol_views_spec.rb
|
@@ -220,7 +262,7 @@ files:
|
|
220
262
|
- spec/views/layout-yield.erb
|
221
263
|
- spec/views/layout.erb
|
222
264
|
- spec/views/layout.str
|
223
|
-
homepage:
|
265
|
+
homepage: http://roda.jeremyevans.net
|
224
266
|
licenses:
|
225
267
|
- MIT
|
226
268
|
metadata: {}
|
@@ -240,8 +282,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
282
|
version: '0'
|
241
283
|
requirements: []
|
242
284
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
285
|
+
rubygems_version: 2.4.4
|
244
286
|
signing_key:
|
245
287
|
specification_version: 4
|
246
|
-
summary: Routing tree web framework
|
288
|
+
summary: Routing tree web framework toolkit
|
247
289
|
test_files: []
|