Capcode 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/README.rdoc +58 -0
  2. data/doc/rdoc/classes/Capcode.html +938 -0
  3. data/doc/rdoc/classes/Capcode/Base.html +136 -0
  4. data/doc/rdoc/classes/Capcode/HTTPError.html +134 -0
  5. data/doc/rdoc/classes/Capcode/Helpers.html +608 -0
  6. data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +188 -0
  7. data/doc/rdoc/classes/Capcode/Mab.html +118 -0
  8. data/doc/rdoc/classes/Capcode/Resource.html +111 -0
  9. data/doc/rdoc/classes/Capcode/Views.html +112 -0
  10. data/doc/rdoc/created.rid +1 -0
  11. data/doc/rdoc/files/AUTHORS.html +107 -0
  12. data/doc/rdoc/files/COPYING.html +531 -0
  13. data/doc/rdoc/files/README_rdoc.html +601 -0
  14. data/doc/rdoc/files/lib/capcode/base/db_rb.html +101 -0
  15. data/doc/rdoc/files/lib/capcode/helpers/auth_rb.html +132 -0
  16. data/doc/rdoc/files/lib/capcode/render/erb_rb.html +108 -0
  17. data/doc/rdoc/files/lib/capcode/render/haml_rb.html +108 -0
  18. data/doc/rdoc/files/lib/capcode/render/json_rb.html +108 -0
  19. data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +108 -0
  20. data/doc/rdoc/files/lib/capcode/render/sass_rb.html +108 -0
  21. data/doc/rdoc/files/lib/capcode/render/static_rb.html +101 -0
  22. data/doc/rdoc/files/lib/capcode/render/text_rb.html +101 -0
  23. data/doc/rdoc/files/lib/capcode/render/webdav_rb.html +124 -0
  24. data/doc/rdoc/files/lib/capcode/render/xml_rb.html +101 -0
  25. data/doc/rdoc/files/lib/capcode_rb.html +119 -0
  26. data/doc/rdoc/fr_class_index.html +34 -0
  27. data/doc/rdoc/fr_file_index.html +41 -0
  28. data/doc/rdoc/fr_method_index.html +44 -0
  29. data/doc/rdoc/index.html +24 -0
  30. data/doc/rdoc/rdoc-style.css +208 -0
  31. data/examples/auth-basic.rb +46 -0
  32. data/examples/auth-digest.rb +47 -0
  33. data/examples/auth-webdav.rb +29 -0
  34. data/examples/blog-couchdb-run.rb +10 -0
  35. data/examples/blog-couchdb.rb +8 -8
  36. data/examples/blog-couchdb.ru +12 -0
  37. data/examples/render-static.rb +1 -1
  38. data/examples/render-static.ru +21 -0
  39. data/examples/render-webdav.rb +26 -0
  40. data/examples/rest-run.rb +3 -0
  41. data/examples/rest.rb +1 -1
  42. data/examples/rest.ru +3 -0
  43. data/lib/capcode.rb +196 -100
  44. data/lib/capcode/helpers/auth.rb +130 -0
  45. data/lib/capcode/render/webdav.rb +45 -0
  46. data/lib/capcode/version.rb +1 -1
  47. metadata +45 -3
@@ -0,0 +1,188 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Capcode::Helpers::Authorization</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Capcode::Helpers::Authorization</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/capcode/helpers/auth_rb.html">
59
+ lib/capcode/helpers/auth.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000018">http_authentication</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <!-- if method_list -->
102
+ <div id="methods">
103
+ <h3 class="section-bar">Public Instance methods</h3>
104
+
105
+ <div id="method-M000018" class="method-detail">
106
+ <a name="M000018"></a>
107
+
108
+ <div class="method-heading">
109
+ <a href="#M000018" class="method-signature">
110
+ <span class="method-name">http_authentication</span><span class="method-args">( opts = {}, &amp;b )</span>
111
+ </a>
112
+ </div>
113
+
114
+ <div class="method-description">
115
+ <p>
116
+ Allow you to add and HTTP Authentication (Basic or Digest) to a controller
117
+ </p>
118
+ <p>
119
+ Options :
120
+ </p>
121
+ <ul>
122
+ <li><tt>:type</tt> : Authentication type (<tt>:basic</tt> or <tt>:digest</tt>)
123
+ - default : <tt>:basic</tt>
124
+
125
+ </li>
126
+ <li><tt>:realm</tt> : realm ;) - default : &quot;Capcode.app&quot;
127
+
128
+ </li>
129
+ <li><tt>:opaque</tt> : Your secret passphrase. You MUST set it if you use
130
+ Digest Auth - default : &quot;opaque&quot;
131
+
132
+ </li>
133
+ </ul>
134
+ <p>
135
+ The block must return a Hash of username =&gt; password like that :
136
+ </p>
137
+ <pre>
138
+ {
139
+ &quot;user1&quot; =&gt; &quot;pass1&quot;,
140
+ &quot;user2&quot; =&gt; &quot;pass2&quot;,
141
+ # ...
142
+ }
143
+ </pre>
144
+ <p><a class="source-toggle" href="#"
145
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
146
+ <div class="method-source-code" id="M000018-source">
147
+ <pre>
148
+ <span class="ruby-comment cmt"># File lib/capcode/helpers/auth.rb, line 106</span>
149
+ 106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_authentication</span>( <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span> )
150
+ 107: <span class="ruby-ivar">@auth</span> = <span class="ruby-keyword kw">nil</span>
151
+ 108:
152
+ 109: <span class="ruby-ivar">@auth_type</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:type</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">:basic</span>
153
+ 110: <span class="ruby-identifier">realm</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:realm</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;Capcode.app&quot;</span>
154
+ 111: <span class="ruby-identifier">opaque</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:opaque</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;opaque&quot;</span>
155
+ 112: <span class="ruby-ivar">@authorizations</span> = <span class="ruby-identifier">b</span>
156
+ 113:
157
+ 114: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">authorized?</span>
158
+ 115:
159
+ 116: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@auth_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:basic</span>
160
+ 117: <span class="ruby-identifier">basic_unauthorized!</span>(<span class="ruby-identifier">realm</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">provided?</span>
161
+ 118: <span class="ruby-identifier">bad_request!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">basic?</span>
162
+ 119: <span class="ruby-identifier">basic_unauthorized!</span>(<span class="ruby-identifier">realm</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">basic_authorize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">auth</span>.<span class="ruby-identifier">credentials</span>)
163
+ 120: <span class="ruby-keyword kw">else</span>
164
+ 121: <span class="ruby-identifier">digest_unauthorized!</span>(<span class="ruby-identifier">realm</span>, <span class="ruby-identifier">opaque</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">provided?</span>
165
+ 122: <span class="ruby-identifier">bad_request!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">digest?</span>
166
+ 123: <span class="ruby-identifier">digest_unauthorized!</span>(<span class="ruby-identifier">realm</span>, <span class="ruby-identifier">opaque</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">digest_authorize</span>
167
+ 124: <span class="ruby-keyword kw">end</span>
168
+ 125:
169
+ 126: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'REMOTE_USER'</span>] = <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">username</span>
170
+ 127: <span class="ruby-keyword kw">end</span>
171
+ </pre>
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+
177
+ </div>
178
+
179
+
180
+ </div>
181
+
182
+
183
+ <div id="validator-badges">
184
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
185
+ </div>
186
+
187
+ </body>
188
+ </html>
@@ -0,0 +1,118 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Capcode::Mab</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Capcode::Mab</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/capcode/render/markaby_rb.html">
59
+ lib/capcode/render/markaby.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Markaby::Builder
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+ <div id="includes">
91
+ <h3 class="section-bar">Included Modules</h3>
92
+
93
+ <div id="includes-list">
94
+ <span class="include-name"><a href="Views.html">Views</a></span>
95
+ </div>
96
+ </div>
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+
109
+
110
+ </div>
111
+
112
+
113
+ <div id="validator-badges">
114
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
115
+ </div>
116
+
117
+ </body>
118
+ </html>
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Capcode::Resource</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Capcode::Resource</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/capcode/base/db_rb.html">
59
+ lib/capcode/base/db.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ This module contains the resources needed in a model
78
+ </p>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+
91
+ <div id="section">
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <!-- if method_list -->
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <div id="validator-badges">
107
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
+ </div>
109
+
110
+ </body>
111
+ </html>
@@ -0,0 +1,112 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Capcode::Views</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Capcode::Views</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/capcode_rb.html">
59
+ lib/capcode.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ <a href="Views.html">Views</a> is an empty module in which you can store
78
+ your markaby or xml views.
79
+ </p>
80
+
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <!-- if method_list -->
102
+
103
+
104
+ </div>
105
+
106
+
107
+ <div id="validator-badges">
108
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
109
+ </div>
110
+
111
+ </body>
112
+ </html>