Capcode 0.8.2 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/{README → README.rdoc} +12 -1
  2. data/examples/haml/cf_layout.haml +1 -0
  3. data/examples/haml/style.sass +2 -0
  4. data/examples/render-erb.rb +14 -0
  5. data/examples/render-haml_sass.rb +22 -0
  6. data/examples/render-json.rb +13 -0
  7. data/examples/render-markaby.rb +27 -0
  8. data/examples/render-static.rb +18 -0
  9. data/examples/render-text.rb +12 -0
  10. data/examples/render-xml.rb +24 -0
  11. data/examples/rest.rb +77 -0
  12. data/examples/upload.rb +4 -4
  13. data/lib/capcode.rb +118 -44
  14. data/lib/capcode/base/db.rb +23 -0
  15. data/lib/capcode/base/dm.rb +11 -11
  16. data/lib/capcode/render/erb.rb +5 -3
  17. data/lib/capcode/render/haml.rb +3 -2
  18. data/lib/capcode/render/json.rb +1 -1
  19. data/lib/capcode/render/markaby.rb +5 -5
  20. data/lib/capcode/render/sass.rb +4 -2
  21. data/lib/capcode/render/static.rb +6 -2
  22. data/lib/capcode/render/text.rb +1 -1
  23. data/lib/capcode/render/xml.rb +3 -5
  24. data/lib/capcode/version.rb +1 -1
  25. metadata +25 -55
  26. data/doc/rdoc/classes/Capcode.html +0 -605
  27. data/doc/rdoc/classes/Capcode/HTTPError.html +0 -129
  28. data/doc/rdoc/classes/Capcode/Helpers.html +0 -342
  29. data/doc/rdoc/classes/Capcode/RenderError.html +0 -129
  30. data/doc/rdoc/classes/Capcode/Views.html +0 -108
  31. data/doc/rdoc/created.rid +0 -1
  32. data/doc/rdoc/files/AUTHORS.html +0 -103
  33. data/doc/rdoc/files/COPYING.html +0 -527
  34. data/doc/rdoc/files/README.html +0 -478
  35. data/doc/rdoc/files/lib/capcode_rb.html +0 -541
  36. data/doc/rdoc/index.html +0 -10
  37. data/doc/rdoc/permalink.gif +0 -0
  38. data/doc/rdoc/rdoc-style.css +0 -106
  39. data/doc/rdoc/rubyfr.png +0 -0
  40. data/doc/rdoc_iphone/classes/Capcode.html +0 -175
  41. data/doc/rdoc_iphone/classes/Capcode/HTTPError.html +0 -21
  42. data/doc/rdoc_iphone/classes/Capcode/Helpers.html +0 -153
  43. data/doc/rdoc_iphone/classes/Capcode/RenderError.html +0 -21
  44. data/doc/rdoc_iphone/classes/Capcode/Views.html +0 -21
  45. data/doc/rdoc_iphone/classes_index.html +0 -10
  46. data/doc/rdoc_iphone/created.rid +0 -1
  47. data/doc/rdoc_iphone/files/AUTHORS.html +0 -11
  48. data/doc/rdoc_iphone/files/COPYING.html +0 -435
  49. data/doc/rdoc_iphone/files/README.html +0 -325
  50. data/doc/rdoc_iphone/files/lib/capcode_rb.html +0 -435
  51. data/doc/rdoc_iphone/files_index.html +0 -7
  52. data/doc/rdoc_iphone/index.html +0 -51
  53. data/doc/rdoc_iphone/iui/backButton.png +0 -0
  54. data/doc/rdoc_iphone/iui/blueButton.png +0 -0
  55. data/doc/rdoc_iphone/iui/cancel.png +0 -0
  56. data/doc/rdoc_iphone/iui/grayButton.png +0 -0
  57. data/doc/rdoc_iphone/iui/iui-logo-touch-icon.png +0 -0
  58. data/doc/rdoc_iphone/iui/iui.css +0 -386
  59. data/doc/rdoc_iphone/iui/iui.js +0 -442
  60. data/doc/rdoc_iphone/iui/iuix.css +0 -1
  61. data/doc/rdoc_iphone/iui/iuix.js +0 -1
  62. data/doc/rdoc_iphone/iui/listArrow.png +0 -0
  63. data/doc/rdoc_iphone/iui/listArrowSel.png +0 -0
  64. data/doc/rdoc_iphone/iui/listGroup.png +0 -0
  65. data/doc/rdoc_iphone/iui/loading.gif +0 -0
  66. data/doc/rdoc_iphone/iui/pinstripes.png +0 -0
  67. data/doc/rdoc_iphone/iui/selection.png +0 -0
  68. data/doc/rdoc_iphone/iui/thumb.png +0 -0
  69. data/doc/rdoc_iphone/iui/toggle.png +0 -0
  70. data/doc/rdoc_iphone/iui/toggleOn.png +0 -0
  71. data/doc/rdoc_iphone/iui/toolButton.png +0 -0
  72. data/doc/rdoc_iphone/iui/toolbar.png +0 -0
  73. data/doc/rdoc_iphone/iui/whiteButton.png +0 -0
  74. data/doc/rdoc_iphone/rdoc-style.css +0 -0
@@ -1,478 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- Capcode, the Documentation &raquo; File: README
7
- </title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
10
- <script language="JavaScript" type="text/javascript">
11
- // <![CDATA[
12
-
13
- function toggleSource( id )
14
- {
15
- var elem
16
- var link
17
-
18
- if( document.getElementById )
19
- {
20
- elem = document.getElementById( id )
21
- link = document.getElementById( "l_" + id )
22
- }
23
- else if ( document.all )
24
- {
25
- elem = eval( "document.all." + id )
26
- link = eval( "document.all.l_" + id )
27
- }
28
- else
29
- return false;
30
-
31
- if( elem.style.display == "block" )
32
- {
33
- elem.style.display = "none"
34
- link.innerHTML = "show source"
35
- }
36
- else
37
- {
38
- elem.style.display = "block"
39
- link.innerHTML = "hide source"
40
- }
41
- }
42
-
43
- function openCode( url )
44
- {
45
- window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
46
- }
47
- // ]]>
48
- </script>
49
- </head>
50
- <body>
51
- <!--
52
- <div id="menu">
53
- <h3 class="title">File: README</h3>
54
- </div>
55
- -->
56
- <div id="fullpage">
57
- <div id="pager">
58
- <table>
59
- <tr><td><img src="../rubyfr.png" /></td>
60
- <td id="pagertd">
61
- <strong># File: README<br />
62
- [
63
- "<a href="../files/README.html" value="File: README">README</a>",
64
- "<a href="../files/AUTHORS.html" value="File: AUTHORS">AUTHORS</a>",
65
- "<a href="../files/COPYING.html" value="File: COPYING">COPYING</a>",
66
- "<a href="../files/lib/capcode_rb.html" value="File: capcode.rb">lib/capcode.rb</a>",
67
- <a href="http://greg.rubyfr.net">nil</a>].each do<br />
68
- <a href="../classes/Capcode.html" title="Module: Capcode">Capcode</a>.view_html<br />
69
- <a href="../classes/Capcode/Views.html" title="Module: Capcode::Views">Capcode::Views</a>.view_html<br />
70
- <a href="../classes/Capcode/Helpers.html" title="Module: Capcode::Helpers">Capcode::Helpers</a>.view_html<br />
71
- <a href="../classes/Capcode/HTTPError.html" title="Class: Capcode::HTTPError">Capcode::HTTPError</a>.view_html<br />
72
- <a href="../classes/Capcode/RenderError.html" title="Class: Capcode::RenderError">Capcode::RenderError</a>.view_html<br />
73
- <a href="../classes/Capcode/RouteError.html" title="Class: Capcode::RouteError">Capcode::RouteError</a>.view_html<br />
74
- <a href="../classes/Capcode/ParameterError.html" title="Class: Capcode::ParameterError">Capcode::ParameterError</a>.view_html<br />
75
- end</strong>
76
- </td></tr>
77
- </table>
78
- </ul>
79
- </div>
80
-
81
- <div id="README" class="page_shade">
82
- <div class="page">
83
- <div class="header">
84
- <div class="path">README / Fri Jul 17 18:22:38 +0200 2009</div>
85
- </div>
86
-
87
- <h1><a href="../classes/Capcode.html">Capcode</a></h1>
88
- <p>
89
- Copyright (C) 2009 Gregoire Lejeune
90
- </p>
91
- <ul>
92
- <li><a href="http://capcode.rubyforge.org">capcode.rubyforge.org</a>
93
-
94
- </li>
95
- </ul>
96
- <h2>DESCRIPTION:</h2>
97
- <p>
98
- <a href="../classes/Capcode.html">Capcode</a> is a web microframework
99
- </p>
100
- <h2>FEATURES/PROBLEMS:</h2>
101
- <h3>0.8.2</h3>
102
- <ul>
103
- <li>Add XML renderer (see rss example)
104
-
105
- </li>
106
- <li>Major bug corrections
107
-
108
- </li>
109
- <li>Add Helpers.static
110
-
111
- </li>
112
- <li>New example : upload.rb
113
-
114
- </li>
115
- <li>The database&#8217; configuration file is no more relative to the root
116
- directory but to the main file
117
-
118
- </li>
119
- </ul>
120
- <h3>0.8.1</h3>
121
- <ul>
122
- <li>Sorry for 0.8.0 !!
123
-
124
- </li>
125
- </ul>
126
- <h3>0.8.0</h3>
127
- <ul>
128
- <li>Bugs corrections in haml and text renderer
129
-
130
- </li>
131
- <li>Text renderer is now automaticaly included
132
-
133
- </li>
134
- <li>Add sass renderer
135
-
136
- </li>
137
- <li>:working_directory is no more available
138
-
139
- </li>
140
- <li>:root is now the real root directory
141
-
142
- </li>
143
- <li>Add :static option to set the directory for static files
144
-
145
- </li>
146
- <li>Add -r and -s (for root and static directories) options
147
-
148
- </li>
149
- <li>Add static renderer
150
-
151
- </li>
152
- </ul>
153
- <h3>0.7.1</h3>
154
- <ul>
155
- <li>You need to include Capcode::Resource in your models !!!!
156
-
157
- </li>
158
- <li>Add option &#8212;version
159
-
160
- </li>
161
- </ul>
162
- <h3>0.7.0</h3>
163
- <ul>
164
- <li>You no more need to include Capcode::Resource in your models
165
-
166
- </li>
167
- <li><a href="../classes/Capcode.html#M000008">Capcode.run</a> now accept a
168
- block. The content of the block is executed just before the server start.
169
-
170
- </li>
171
- <li>Add options support : you can now change the defaults port and host,
172
- daemonize or not and run in console mode.
173
-
174
- </li>
175
- </ul>
176
- <h3>0.6.2</h3>
177
- <ul>
178
- <li>Add Markaby, Erb and Haml layout see Capcode::Helpers.render for more
179
- informations
180
-
181
- </li>
182
- <li>Add content_for&#8230;
183
-
184
- </li>
185
- <li>Major bugs corrections
186
-
187
- </li>
188
- </ul>
189
- <h3>0.6.1</h3>
190
- <ul>
191
- <li>Major bugs corrections in haml and erb renderer ($%&amp;! Windows)
192
-
193
- </li>
194
- <li>Major bugs corrections in Route.call
195
-
196
- </li>
197
- <li>Add Markaby layout support
198
-
199
- </li>
200
- <li>Rewrite blog-couchdb example (based on the very sympatic camping example :
201
- <a
202
- href="http://github.com/judofyr/camping/blob/master/examples/blog.rb">github.com/judofyr/camping/blob/master/examples/blog.rb</a>)
203
-
204
- </li>
205
- </ul>
206
- <h3>0.6.0</h3>
207
- <ul>
208
- <li>Add :root option to <a
209
- href="../classes/Capcode.html#M000008">Capcode.run</a>. This option allow
210
- you to specify the root directory for static files
211
-
212
- </li>
213
- <li>Add :working_directory option to <a
214
- href="../classes/Capcode.html#M000008">Capcode.run</a>. This option allow
215
- you to specify the working directory
216
-
217
- </li>
218
- <li>If &#8217;/&#8217; route is not defined but /index.html exist, display
219
- index
220
-
221
- </li>
222
- <li>add mime-types dependency
223
-
224
- </li>
225
- <li>Bug correction in erb and haml renderer
226
-
227
- </li>
228
- </ul>
229
- <h3>0.5.0</h3>
230
- <ul>
231
- <li>Add Haml and Markaby renderer
232
-
233
- </li>
234
- <li>json is deprecated and replaced by render( :json =&gt; &#8230; )
235
-
236
- </li>
237
- </ul>
238
- <h3>0.4.0</h3>
239
- <ul>
240
- <li>Major bug correction !
241
-
242
- </li>
243
- <li>Add views&#8230;
244
-
245
- </li>
246
- </ul>
247
- <h3>0.3.0</h3>
248
- <ul>
249
- <li>Work with Rack 1.0.0
250
-
251
- </li>
252
- </ul>
253
- <h3>0.2.0</h3>
254
- <ul>
255
- <li>Add models with DataMapper and couch_foo
256
-
257
- </li>
258
- <li>Add two new options : :daemonize and :pid
259
-
260
- </li>
261
- <li>Bug correction in Route.
262
-
263
- </li>
264
- </ul>
265
- <h3>0.1.0</h3>
266
- <ul>
267
- <li>First public release
268
-
269
- </li>
270
- <li>No models !!!
271
-
272
- </li>
273
- </ul>
274
- <h2>SYNOPSIS:</h2>
275
- <pre>
276
- # file: sample.rb
277
- require 'rubygems'
278
- require 'capcode'
279
-
280
- module Capcode
281
- class Hello &lt; Route '/hello'
282
- def get
283
- &quot;Hello World #{Time.now} !&quot;
284
- end
285
- end
286
- end
287
-
288
- Capcode.run( )
289
- </pre>
290
- <h3>Running <a href="../classes/Capcode.html">Capcode</a> Apps</h3>
291
- <ul>
292
- <li>Run: <tt>ruby sample.rb</tt>
293
-
294
- </li>
295
- <li>Visit <a href="http://localhost:3000">localhost:3000</a>/
296
-
297
- </li>
298
- </ul>
299
- <h3>Create model</h3>
300
- <pre>
301
- require 'rubygems'
302
- require 'capcode'
303
- require 'capcode/base/dm' # or require 'capcode/base/couchdb'
304
-
305
- class Story &lt; Capcode::Base
306
- include Capcode::Resource
307
-
308
- property :id, Integer, :serial =&gt; true # only with DataMapper !
309
- property :title, String
310
- property :body, String
311
- property :date, String
312
- end
313
- </pre>
314
- <p>
315
- See <tt>examples/blog-dm.rb</tt> and/or <tt>examples/blog-couchdb.rb</tt>
316
- for complete examples.
317
- </p>
318
- <h3>Create View</h3>
319
- <pre>
320
- # file: sample.rb
321
- require 'rubygems'
322
- require 'capcode'
323
-
324
- module Capcode
325
- class Hello &lt; Route '/hello'
326
- def get
327
- @t = Time.now
328
- render :time
329
- end
330
- end
331
- end
332
-
333
- module Capcode::Views
334
- def time
335
- &quot;Hello world #{@t}&quot;
336
- end
337
- end
338
-
339
- Capcode.run( )
340
- </pre>
341
- <h3>Create Helper</h3>
342
- <pre>
343
- # file: sample.rb
344
- require 'rubygems'
345
- require 'capcode'
346
-
347
- module Capcode
348
- class Hello &lt; Route '/hello'
349
- def get
350
- @t = Time.now
351
- render :time
352
- end
353
- end
354
- end
355
-
356
- module Capcode::Helpers
357
- def bold( &amp;b )
358
- &quot;&lt;b&gt;&quot;+yield+&quot;&lt;/b&gt;&quot;
359
- end
360
- end
361
-
362
- module Capcode::Views
363
- def time
364
- &quot;Hello world &quot; + bold { @t }
365
- end
366
- end
367
-
368
- Capcode.run( )
369
- </pre>
370
- <h3>Render with Markaby</h3>
371
- <pre>
372
- # file: sample.rb
373
- require 'rubygems'
374
- require 'capcode'
375
- require 'capcode/render/markaby'
376
-
377
- module Capcode
378
- class Hello &lt; Route '/hello'
379
- def get
380
- @t = Time.now
381
- render :markaby =&gt; :time
382
- end
383
- end
384
- end
385
-
386
- module Capcode::Views
387
- def time
388
- # We use Markaby in Capcode::Views.time
389
- html do
390
- body do
391
- p {
392
- text &quot;Hello World &quot;
393
- b @t
394
- }
395
- end
396
- end
397
- end
398
- end
399
-
400
- Capcode.run( )
401
- </pre>
402
- <h3>Render with Haml</h3>
403
- <pre>
404
- # file: sample.rb
405
- require 'rubygems'
406
- require 'capcode'
407
- require 'capcode/render/haml'
408
- Capcode::Helpers.haml_path = &quot;./my_haml_views&quot;
409
-
410
- module Capcode
411
- class Hello &lt; Route '/hello'
412
- def get
413
- @t = Time.now
414
- render :haml =&gt; :time
415
- end
416
- end
417
- end
418
-
419
- Capcode.run( )
420
-
421
- # ./my_haml_views/time.haml
422
- %html
423
- %body
424
- %p
425
- Hello World
426
- = @t
427
- </pre>
428
- <h3>Render with JSON</h3>
429
- <pre>
430
- # file: sample.rb
431
- require 'rubygems'
432
- require 'capcode'
433
- require 'capcode/render/json'
434
-
435
- module Capcode
436
- class Hello &lt; Route '/hello'
437
- def get
438
- @t = Time.now
439
- render :json =&gt; { :time =&gt; @t }
440
- end
441
- end
442
- end
443
-
444
- Capcode.run( )
445
- </pre>
446
- <h2>REQUIREMENTS:</h2>
447
- <ul>
448
- <li>rack
449
-
450
- </li>
451
- </ul>
452
- <h2>INSTALL:</h2>
453
- <pre>
454
- sudo gem install capcode
455
- </pre>
456
- <h2>LICENSE:</h2>
457
- <p>
458
- <a href="../classes/Capcode.html">Capcode</a> is freely distributable
459
- according to the terms of the GNU General Public License.
460
- </p>
461
- <p>
462
- This program is distributed without any warranty. See the file
463
- &#8216;COPYING&#8217; for details.
464
- </p>
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
- </div>
473
- </div>
474
-
475
-
476
- </div>
477
- </body>
478
- </html>