Capcode 0.8.7 → 0.8.8
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.
- data/README.rdoc +10 -1
- data/doc/rdoc/classes/Capcode.html +410 -390
- data/doc/rdoc/classes/Capcode/Helpers.html +146 -126
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +26 -2
- data/doc/rdoc/files/lib/capcode/render/haml_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/json_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/sass_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/webdav_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode_rb.html +1 -1
- data/doc/rdoc/fr_file_index.html +5 -0
- data/examples/blog-ar.rb +81 -0
- data/examples/blog-ar.yml +3 -0
- data/examples/blog-sq.rb +82 -0
- data/examples/blog-sq.yml +3 -0
- data/examples/mail/mail_html.rhtml +1 -0
- data/examples/mail/mail_text.rhtml +1 -0
- data/examples/mail/ok.rhtml +1 -0
- data/examples/mail/rubyfr.png +0 -0
- data/examples/mustache/with_class.mustache +8 -0
- data/examples/mustache/without_class.mustache +1 -0
- data/examples/render-binary.rb +46 -0
- data/examples/render-email.rb +68 -0
- data/examples/render-erb.rb +2 -0
- data/examples/render-mustache.rb +30 -0
- data/examples/render-redirect.rb +19 -0
- data/lib/capcode.rb +3 -0
- data/lib/capcode/base/ar.rb +54 -0
- data/lib/capcode/base/couchdb.rb +5 -1
- data/lib/capcode/base/dm.rb +5 -1
- data/lib/capcode/base/sq.rb +58 -0
- data/lib/capcode/core_ext.rb +1 -1
- data/lib/capcode/render/binary.rb +8 -0
- data/lib/capcode/render/email.rb +73 -0
- data/lib/capcode/render/haml.rb +5 -1
- data/lib/capcode/render/json.rb +5 -1
- data/lib/capcode/render/markaby.rb +5 -1
- data/lib/capcode/render/mustache.rb +37 -0
- data/lib/capcode/render/none.rb +7 -0
- data/lib/capcode/render/redirect.rb +7 -0
- data/lib/capcode/render/sass.rb +5 -1
- data/lib/capcode/render/webdav.rb +11 -7
- data/lib/capcode/version.rb +1 -1
- metadata +30 -3
- data/examples/my_blog.db +0 -0
@@ -58,6 +58,14 @@
|
|
58
58
|
<a href="../../files/lib/capcode_rb.html">
|
59
59
|
lib/capcode.rb
|
60
60
|
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/capcode/render/binary_rb.html">
|
63
|
+
lib/capcode/render/binary.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../files/lib/capcode/render/email_rb.html">
|
67
|
+
lib/capcode/render/email.rb
|
68
|
+
</a>
|
61
69
|
<br />
|
62
70
|
<a href="../../files/lib/capcode/render/erb_rb.html">
|
63
71
|
lib/capcode/render/erb.rb
|
@@ -74,6 +82,18 @@
|
|
74
82
|
<a href="../../files/lib/capcode/render/markaby_rb.html">
|
75
83
|
lib/capcode/render/markaby.rb
|
76
84
|
</a>
|
85
|
+
<br />
|
86
|
+
<a href="../../files/lib/capcode/render/mustache_rb.html">
|
87
|
+
lib/capcode/render/mustache.rb
|
88
|
+
</a>
|
89
|
+
<br />
|
90
|
+
<a href="../../files/lib/capcode/render/none_rb.html">
|
91
|
+
lib/capcode/render/none.rb
|
92
|
+
</a>
|
93
|
+
<br />
|
94
|
+
<a href="../../files/lib/capcode/render/redirect_rb.html">
|
95
|
+
lib/capcode/render/redirect.rb
|
96
|
+
</a>
|
77
97
|
<br />
|
78
98
|
<a href="../../files/lib/capcode/render/sass_rb.html">
|
79
99
|
lib/capcode/render/sass.rb
|
@@ -190,10 +210,10 @@ controllers
|
|
190
210
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
191
211
|
<div class="method-source-code" id="M000014-source">
|
192
212
|
<pre>
|
193
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
194
|
-
|
195
|
-
|
196
|
-
|
213
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 46</span>
|
214
|
+
46: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args</span>
|
215
|
+
47: <span class="ruby-ivar">@args</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">nil</span>
|
216
|
+
48: <span class="ruby-keyword kw">end</span>
|
197
217
|
</pre>
|
198
218
|
</div>
|
199
219
|
</div>
|
@@ -213,10 +233,10 @@ controllers
|
|
213
233
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
214
234
|
<div class="method-source-code" id="M000015-source">
|
215
235
|
<pre>
|
216
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
217
|
-
|
218
|
-
|
219
|
-
|
236
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 49</span>
|
237
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args=</span>(<span class="ruby-identifier">x</span>)
|
238
|
+
50: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">x</span>
|
239
|
+
51: <span class="ruby-keyword kw">end</span>
|
220
240
|
</pre>
|
221
241
|
</div>
|
222
242
|
</div>
|
@@ -272,11 +292,11 @@ will be removed in version 1.0
|
|
272
292
|
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
273
293
|
<div class="method-source-code" id="M000023-source">
|
274
294
|
<pre>
|
275
|
-
<span class="ruby-comment cmt"># File lib/capcode/render/haml.rb, line
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
295
|
+
<span class="ruby-comment cmt"># File lib/capcode/render/haml.rb, line 11</span>
|
296
|
+
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">haml_path=</span>( <span class="ruby-identifier">p</span> )
|
297
|
+
12: <span class="ruby-identifier">warn</span> <span class="ruby-value str">"Capcode::Helpers.haml_path is deprecated and will be removed in version 1.0, please use `set :haml'"</span>
|
298
|
+
13: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">set</span> <span class="ruby-identifier">:haml</span>, <span class="ruby-identifier">p</span>
|
299
|
+
14: <span class="ruby-keyword kw">end</span>
|
280
300
|
</pre>
|
281
301
|
</div>
|
282
302
|
</div>
|
@@ -302,11 +322,11 @@ will be removed in version 1.0
|
|
302
322
|
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
303
323
|
<div class="method-source-code" id="M000024-source">
|
304
324
|
<pre>
|
305
|
-
<span class="ruby-comment cmt"># File lib/capcode/render/sass.rb, line
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
325
|
+
<span class="ruby-comment cmt"># File lib/capcode/render/sass.rb, line 11</span>
|
326
|
+
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sass_path=</span>( <span class="ruby-identifier">p</span> )
|
327
|
+
12: <span class="ruby-identifier">warn</span> <span class="ruby-value str">"Capcode::Helpers.sass_path is deprecated and will be removed in version 1.0, please use `set :sass'"</span>
|
328
|
+
13: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">set</span> <span class="ruby-identifier">:sass</span>, <span class="ruby-identifier">p</span>
|
329
|
+
14: <span class="ruby-keyword kw">end</span>
|
310
330
|
</pre>
|
311
331
|
</div>
|
312
332
|
</div>
|
@@ -348,21 +368,21 @@ then
|
|
348
368
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
349
369
|
<div class="method-source-code" id="M000019-source">
|
350
370
|
<pre>
|
351
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
371
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 184</span>
|
372
|
+
184: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">URL</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
|
373
|
+
185: <span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">nil</span>
|
374
|
+
186: <span class="ruby-identifier">a</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> }
|
375
|
+
187:
|
376
|
+
188: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Class</span>
|
377
|
+
189: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">routes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
378
|
+
190: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">klass</span>
|
379
|
+
191: <span class="ruby-keyword kw">end</span>
|
380
|
+
192: <span class="ruby-keyword kw">else</span>
|
381
|
+
193: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">klass</span>
|
382
|
+
194: <span class="ruby-keyword kw">end</span>
|
383
|
+
195:
|
384
|
+
196: (<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RACK_BASE_URI'</span>]<span class="ruby-operator">||</span><span class="ruby-value str">''</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">path</span><span class="ruby-operator">+</span>((<span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">></span><span class="ruby-value">0</span>)<span class="ruby-operator">?</span>(<span class="ruby-value str">"/"</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"/"</span>))<span class="ruby-operator">:</span>(<span class="ruby-value str">""</span>))
|
385
|
+
197: <span class="ruby-keyword kw">end</span>
|
366
386
|
</pre>
|
367
387
|
</div>
|
368
388
|
</div>
|
@@ -418,13 +438,13 @@ markup in an identifier.
|
|
418
438
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
419
439
|
<div class="method-source-code" id="M000020-source">
|
420
440
|
<pre>
|
421
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
441
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 231</span>
|
442
|
+
231: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_for</span>( <span class="ruby-identifier">x</span> )
|
443
|
+
232: <span class="ruby-comment cmt">#if @@__ARGS__.map{|_| _.to_s }.include?(x.to_s)</span>
|
444
|
+
233: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_</span>.<span class="ruby-identifier">to_s</span> }.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_s</span>)
|
445
|
+
234: <span class="ruby-keyword kw">yield</span>
|
446
|
+
235: <span class="ruby-keyword kw">end</span>
|
447
|
+
236: <span class="ruby-keyword kw">end</span>
|
428
448
|
</pre>
|
429
449
|
</div>
|
430
450
|
</div>
|
@@ -461,12 +481,12 @@ href="Helpers.html#M000017">json</a> => o )</tt>
|
|
461
481
|
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
462
482
|
<div class="method-source-code" id="M000017-source">
|
463
483
|
<pre>
|
464
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
484
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 127</span>
|
485
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json</span>( <span class="ruby-identifier">d</span> ) <span class="ruby-comment cmt">## DELETE THIS IN 1.0.0</span>
|
486
|
+
128: <span class="ruby-identifier">warn</span>( <span class="ruby-value str">"json is deprecated and will be removed in version 1.0, please use `render( :json => ... )'"</span> )
|
487
|
+
129: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'application/json'</span>
|
488
|
+
130: <span class="ruby-identifier">d</span>.<span class="ruby-identifier">to_json</span>
|
489
|
+
131: <span class="ruby-keyword kw">end</span>
|
470
490
|
</pre>
|
471
491
|
</div>
|
472
492
|
</div>
|
@@ -525,17 +545,17 @@ href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection">en
|
|
525
545
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
526
546
|
<div class="method-source-code" id="M000018-source">
|
527
547
|
<pre>
|
528
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
548
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 160</span>
|
549
|
+
160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
|
550
|
+
161: <span class="ruby-identifier">httpCode</span> = <span class="ruby-value">302</span>
|
551
|
+
162:
|
552
|
+
163: <span class="ruby-keyword kw">if</span>( <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Fixnum</span> )
|
553
|
+
164: <span class="ruby-identifier">httpCode</span> = <span class="ruby-identifier">klass</span>
|
554
|
+
165: <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">shift</span>
|
555
|
+
166: <span class="ruby-keyword kw">end</span>
|
556
|
+
167:
|
557
|
+
168: [<span class="ruby-identifier">httpCode</span>, {<span class="ruby-value str">'Location'</span> =<span class="ruby-operator">></span> <span class="ruby-constant">URL</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)}, <span class="ruby-value str">''</span>]
|
558
|
+
169: <span class="ruby-keyword kw">end</span>
|
539
559
|
</pre>
|
540
560
|
</div>
|
541
561
|
</div>
|
@@ -626,43 +646,43 @@ If you use the WebDav renderer, you can use the option
|
|
626
646
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
627
647
|
<div class="method-source-code" id="M000016-source">
|
628
648
|
<pre>
|
629
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
649
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 79</span>
|
650
|
+
79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">hash</span> )
|
651
|
+
80: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
652
|
+
81: <span class="ruby-identifier">render_type</span> = <span class="ruby-keyword kw">nil</span>
|
653
|
+
82:
|
654
|
+
83: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
655
|
+
84: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{key.to_s}"</span>)
|
656
|
+
85: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
657
|
+
86: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Can't use multiple renderer (`#{render_type}' and `#{key}') !"</span>, <span class="ruby-identifier">caller</span>
|
658
|
+
87: <span class="ruby-keyword kw">end</span>
|
659
|
+
88: <span class="ruby-identifier">render_type</span> = <span class="ruby-identifier">key</span>
|
660
|
+
89: <span class="ruby-keyword kw">end</span>
|
661
|
+
90: <span class="ruby-keyword kw">end</span>
|
662
|
+
91:
|
663
|
+
92: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
664
|
+
93: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-value str">"Renderer type not specified!"</span>, <span class="ruby-identifier">caller</span>
|
665
|
+
94: <span class="ruby-keyword kw">end</span>
|
666
|
+
95:
|
667
|
+
96: <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{render_type.to_s}"</span>)
|
668
|
+
97: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"#{render_type} renderer not present ! please require 'capcode/render/#{render_type}'"</span>, <span class="ruby-identifier">caller</span>
|
669
|
+
98: <span class="ruby-keyword kw">end</span>
|
670
|
+
99:
|
671
|
+
100: <span class="ruby-identifier">render_name</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">render_type</span>)
|
672
|
+
101: <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:content_type</span>)
|
673
|
+
102: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">nil?</span>
|
674
|
+
103: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">content_type</span>
|
675
|
+
104: <span class="ruby-keyword kw">end</span>
|
676
|
+
105:
|
677
|
+
106: <span class="ruby-keyword kw">begin</span>
|
678
|
+
107: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-node">"render_#{render_type.to_s}"</span>, <span class="ruby-identifier">render_name</span>, <span class="ruby-identifier">hash</span> )
|
679
|
+
108: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
680
|
+
109: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Error rendering `#{render_type.to_s}' : #{e.message}"</span>, <span class="ruby-identifier">caller</span>
|
681
|
+
110: <span class="ruby-keyword kw">end</span>
|
682
|
+
111: <span class="ruby-keyword kw">else</span>
|
683
|
+
112: <span class="ruby-identifier">render</span>( <span class="ruby-identifier">:text</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">hash</span> )
|
684
|
+
113: <span class="ruby-keyword kw">end</span>
|
685
|
+
114: <span class="ruby-keyword kw">end</span>
|
666
686
|
</pre>
|
667
687
|
</div>
|
668
688
|
</div>
|
@@ -682,32 +702,32 @@ If you use the WebDav renderer, you can use the option
|
|
682
702
|
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
683
703
|
<div class="method-source-code" id="M000025-source">
|
684
704
|
<pre>
|
685
|
-
<span class="ruby-comment cmt"># File lib/capcode/render/webdav.rb, line
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
34:
|
702
|
-
35: <span class="ruby-comment cmt"># Strings in Ruby 1.9 are no longer enumerable. Rack still expects the response.body to be</span>
|
703
|
-
36: <span class="ruby-comment cmt"># enumerable, however.</span>
|
704
|
-
37: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span> = [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:each</span>
|
705
|
+
<span class="ruby-comment cmt"># File lib/capcode/render/webdav.rb, line 23</span>
|
706
|
+
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_webdav</span>( <span class="ruby-identifier">f</span>, <span class="ruby-identifier">opts</span> )
|
707
|
+
24: <span class="ruby-identifier">options</span> = {
|
708
|
+
25: <span class="ruby-identifier">:resource_class</span> =<span class="ruby-operator">></span> <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">FileResource</span>,
|
709
|
+
26: <span class="ruby-identifier">:root</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">f</span>
|
710
|
+
27: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>)
|
711
|
+
28:
|
712
|
+
29: <span class="ruby-identifier">request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
|
713
|
+
30: <span class="ruby-identifier">response</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
|
714
|
+
31:
|
715
|
+
32: <span class="ruby-keyword kw">begin</span>
|
716
|
+
33: <span class="ruby-identifier">controller</span> = <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">Controller</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>)
|
717
|
+
34: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_method</span>.<span class="ruby-identifier">downcase</span>)
|
718
|
+
35: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPStatus</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">status</span>
|
719
|
+
36: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">code</span>
|
720
|
+
37: <span class="ruby-keyword kw">end</span>
|
705
721
|
38:
|
706
|
-
39: <span class="ruby-
|
707
|
-
40: <span class="ruby-
|
708
|
-
41:
|
709
|
-
42:
|
710
|
-
43:
|
722
|
+
39: <span class="ruby-comment cmt"># Strings in Ruby 1.9 are no longer enumerable. Rack still expects the response.body to be</span>
|
723
|
+
40: <span class="ruby-comment cmt"># enumerable, however.</span>
|
724
|
+
41: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span> = [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:each</span>
|
725
|
+
42:
|
726
|
+
43: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-value">? </span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">:</span> <span class="ruby-value">200</span>
|
727
|
+
44: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">finish</span>
|
728
|
+
45:
|
729
|
+
46: [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">header</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>]
|
730
|
+
47: <span class="ruby-keyword kw">end</span>
|
711
731
|
</pre>
|
712
732
|
</div>
|
713
733
|
</div>
|
@@ -741,13 +761,13 @@ the <a href="Helpers.html#M000021">static</a> directory on the server
|
|
741
761
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
742
762
|
<div class="method-source-code" id="M000021-source">
|
743
763
|
<pre>
|
744
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
764
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 242</span>
|
765
|
+
242: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">static</span>
|
766
|
+
243: {
|
767
|
+
244: <span class="ruby-identifier">:uri</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span>,
|
768
|
+
245: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"."</span>, <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span> ) )
|
769
|
+
246: }
|
770
|
+
247: <span class="ruby-keyword kw">end</span>
|
751
771
|
</pre>
|
752
772
|
</div>
|
753
773
|
</div>
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Tue, 17 Nov 2009 21:53:40 +0100
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Tue Nov 17 12:00:12 +0100 2009</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -91,9 +91,33 @@ href="http://www.algorithmique.net/capcode">www.algorithmique.net/capcode</a>/
|
|
91
91
|
<a href="../classes/Capcode.html">Capcode</a> is a web microframework
|
92
92
|
</p>
|
93
93
|
<h2>FEATURES/PROBLEMS:</h2>
|
94
|
+
<h3>0.8.8</h3>
|
95
|
+
<ul>
|
96
|
+
<li>Add mustache renderer
|
97
|
+
|
98
|
+
</li>
|
99
|
+
<li>Add AcriveRecord support (see example blog-ar.rb)
|
100
|
+
|
101
|
+
</li>
|
102
|
+
<li>Add Sequel support (see example blog-sq.rb)
|
103
|
+
|
104
|
+
</li>
|
105
|
+
<li>Add Binary renderer (see example render-binary.rb)
|
106
|
+
|
107
|
+
</li>
|
108
|
+
<li>Add Mail renderer (see example render-mail.rb)
|
109
|
+
|
110
|
+
</li>
|
111
|
+
<li>Add Redirect renderer (see examples render-redirect.rb and render-mail.rb)
|
112
|
+
|
113
|
+
</li>
|
114
|
+
<li>Add "none" renderer (return a 204 status code)
|
115
|
+
|
116
|
+
</li>
|
117
|
+
</ul>
|
94
118
|
<h3>0.8.7</h3>
|
95
119
|
<ul>
|
96
|
-
<li>Route‘s captures are now passed to all methods in a
|
120
|
+
<li>Route‘s captures are now passed to all methods in a controller
|
97
121
|
|
98
122
|
</li>
|
99
123
|
<li>Add :content_type option to renderers (see render-image.rb)
|