Capcode 0.8.2 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.rdoc} +12 -1
- data/examples/haml/cf_layout.haml +1 -0
- data/examples/haml/style.sass +2 -0
- data/examples/render-erb.rb +14 -0
- data/examples/render-haml_sass.rb +22 -0
- data/examples/render-json.rb +13 -0
- data/examples/render-markaby.rb +27 -0
- data/examples/render-static.rb +18 -0
- data/examples/render-text.rb +12 -0
- data/examples/render-xml.rb +24 -0
- data/examples/rest.rb +77 -0
- data/examples/upload.rb +4 -4
- data/lib/capcode.rb +118 -44
- data/lib/capcode/base/db.rb +23 -0
- data/lib/capcode/base/dm.rb +11 -11
- data/lib/capcode/render/erb.rb +5 -3
- data/lib/capcode/render/haml.rb +3 -2
- data/lib/capcode/render/json.rb +1 -1
- data/lib/capcode/render/markaby.rb +5 -5
- data/lib/capcode/render/sass.rb +4 -2
- data/lib/capcode/render/static.rb +6 -2
- data/lib/capcode/render/text.rb +1 -1
- data/lib/capcode/render/xml.rb +3 -5
- data/lib/capcode/version.rb +1 -1
- metadata +25 -55
- data/doc/rdoc/classes/Capcode.html +0 -605
- data/doc/rdoc/classes/Capcode/HTTPError.html +0 -129
- data/doc/rdoc/classes/Capcode/Helpers.html +0 -342
- data/doc/rdoc/classes/Capcode/RenderError.html +0 -129
- data/doc/rdoc/classes/Capcode/Views.html +0 -108
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/AUTHORS.html +0 -103
- data/doc/rdoc/files/COPYING.html +0 -527
- data/doc/rdoc/files/README.html +0 -478
- data/doc/rdoc/files/lib/capcode_rb.html +0 -541
- data/doc/rdoc/index.html +0 -10
- data/doc/rdoc/permalink.gif +0 -0
- data/doc/rdoc/rdoc-style.css +0 -106
- data/doc/rdoc/rubyfr.png +0 -0
- data/doc/rdoc_iphone/classes/Capcode.html +0 -175
- data/doc/rdoc_iphone/classes/Capcode/HTTPError.html +0 -21
- data/doc/rdoc_iphone/classes/Capcode/Helpers.html +0 -153
- data/doc/rdoc_iphone/classes/Capcode/RenderError.html +0 -21
- data/doc/rdoc_iphone/classes/Capcode/Views.html +0 -21
- data/doc/rdoc_iphone/classes_index.html +0 -10
- data/doc/rdoc_iphone/created.rid +0 -1
- data/doc/rdoc_iphone/files/AUTHORS.html +0 -11
- data/doc/rdoc_iphone/files/COPYING.html +0 -435
- data/doc/rdoc_iphone/files/README.html +0 -325
- data/doc/rdoc_iphone/files/lib/capcode_rb.html +0 -435
- data/doc/rdoc_iphone/files_index.html +0 -7
- data/doc/rdoc_iphone/index.html +0 -51
- data/doc/rdoc_iphone/iui/backButton.png +0 -0
- data/doc/rdoc_iphone/iui/blueButton.png +0 -0
- data/doc/rdoc_iphone/iui/cancel.png +0 -0
- data/doc/rdoc_iphone/iui/grayButton.png +0 -0
- data/doc/rdoc_iphone/iui/iui-logo-touch-icon.png +0 -0
- data/doc/rdoc_iphone/iui/iui.css +0 -386
- data/doc/rdoc_iphone/iui/iui.js +0 -442
- data/doc/rdoc_iphone/iui/iuix.css +0 -1
- data/doc/rdoc_iphone/iui/iuix.js +0 -1
- data/doc/rdoc_iphone/iui/listArrow.png +0 -0
- data/doc/rdoc_iphone/iui/listArrowSel.png +0 -0
- data/doc/rdoc_iphone/iui/listGroup.png +0 -0
- data/doc/rdoc_iphone/iui/loading.gif +0 -0
- data/doc/rdoc_iphone/iui/pinstripes.png +0 -0
- data/doc/rdoc_iphone/iui/selection.png +0 -0
- data/doc/rdoc_iphone/iui/thumb.png +0 -0
- data/doc/rdoc_iphone/iui/toggle.png +0 -0
- data/doc/rdoc_iphone/iui/toggleOn.png +0 -0
- data/doc/rdoc_iphone/iui/toolButton.png +0 -0
- data/doc/rdoc_iphone/iui/toolbar.png +0 -0
- data/doc/rdoc_iphone/iui/whiteButton.png +0 -0
- data/doc/rdoc_iphone/rdoc-style.css +0 -0
data/doc/rdoc/index.html
DELETED
data/doc/rdoc/permalink.gif
DELETED
Binary file
|
data/doc/rdoc/rdoc-style.css
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
|
2
|
-
body {
|
3
|
-
font: normal 14px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
|
4
|
-
line-height: 160%;
|
5
|
-
padding: 0; margin: 0;
|
6
|
-
margin-bottom: 30px;
|
7
|
-
/* background-color: #402; */
|
8
|
-
background-color: #CCCC99;
|
9
|
-
}
|
10
|
-
h1, h2, h3, h4 {
|
11
|
-
font-family: Utopia, Georgia, serif;
|
12
|
-
font-weight: bold;
|
13
|
-
letter-spacing: -0.018em;
|
14
|
-
}
|
15
|
-
h1 { font-size: 24px; margin: .15em 1em 0 0 }
|
16
|
-
h2 { font-size: 24px }
|
17
|
-
h3 { font-size: 19px }
|
18
|
-
h4 { font-size: 17px; font-weight: normal; }
|
19
|
-
h4.ruled { border-bottom: solid 1px #CC9; }
|
20
|
-
h2.ruled { padding-top: 35px; border-top: solid 1px #AA5; }
|
21
|
-
|
22
|
-
/* Link styles */
|
23
|
-
:link, :visited {
|
24
|
-
|
25
|
-
}
|
26
|
-
:link:hover, :visited:hover {
|
27
|
-
|
28
|
-
}
|
29
|
-
#fullpage {
|
30
|
-
width: 720px;
|
31
|
-
padding-top: 20px;
|
32
|
-
margin: 0 auto;
|
33
|
-
}
|
34
|
-
.page_shade, .page {
|
35
|
-
border-left: 1px solid black;
|
36
|
-
border-right: 1px solid black;
|
37
|
-
border-bottom: 1px solid black;
|
38
|
-
background-color: #FFFFFF;
|
39
|
-
}
|
40
|
-
.page {
|
41
|
-
padding: 20px 35px;
|
42
|
-
}
|
43
|
-
.page .header {
|
44
|
-
float: right;
|
45
|
-
color: #777;
|
46
|
-
font-size: 10px;
|
47
|
-
}
|
48
|
-
.page h1, .page h2, .page h3 {
|
49
|
-
clear: both;
|
50
|
-
text-align: center;
|
51
|
-
}
|
52
|
-
#pager {
|
53
|
-
background-color: #EEEEAE;
|
54
|
-
border-top: 2px solid black;
|
55
|
-
border-left: 2px solid black;
|
56
|
-
border-right: 2px solid black;
|
57
|
-
border-bottom: 1px dashed #999966;
|
58
|
-
padding: 20px 0 20px 20px;
|
59
|
-
color: #666633;
|
60
|
-
font-size: 11px;
|
61
|
-
}
|
62
|
-
#pager :link, #pager :visited {
|
63
|
-
color: #8E2400;
|
64
|
-
padding: 0px 5px;
|
65
|
-
}
|
66
|
-
#pager :link:hover, #pager :visited:hover {
|
67
|
-
color: #8E2400;
|
68
|
-
}
|
69
|
-
#pagertd {
|
70
|
-
font-size: 11px;
|
71
|
-
}
|
72
|
-
#logo { float: left; }
|
73
|
-
#menu {
|
74
|
-
padding: 4px 12px;
|
75
|
-
margin: 0;
|
76
|
-
}
|
77
|
-
#menu h3 { padding: 0; margin: 0; }
|
78
|
-
#menu #links { float: right; }
|
79
|
-
pre { font-weight: bold; color: black; }
|
80
|
-
tt { color: #703; font-size: 12pt; }
|
81
|
-
.dyn-source {
|
82
|
-
background-color: #EEEEEE;
|
83
|
-
border: 1px solid #CCCCCC;
|
84
|
-
padding: 4px 8px;
|
85
|
-
margin: 0;
|
86
|
-
display: none; }
|
87
|
-
.dyn-source pre {
|
88
|
-
color: #000000;
|
89
|
-
font-size: 8pt;
|
90
|
-
font-familly: monospace;
|
91
|
-
|
92
|
-
}
|
93
|
-
.source-link { text-align: right; font-size: 8pt; }
|
94
|
-
.ruby-comment { color: black; font-style: italic }
|
95
|
-
.ruby-constant { color: #123456; font-weight: bold; }
|
96
|
-
.ruby-identifier { color: #005599; }
|
97
|
-
.ruby-ivar { color: orange; }
|
98
|
-
.ruby-keyword { color: red; font-weight: bold }
|
99
|
-
.ruby-node { color: #FFFFFF; }
|
100
|
-
.ruby-operator { color: #055005; }
|
101
|
-
.ruby-regexp { color: #DDFFDD; }
|
102
|
-
.ruby-value { color: #FFAAAA; font-style: italic }
|
103
|
-
.kw { color: red; font-weight: bold }
|
104
|
-
.cmt { color: green; font-style: italic }
|
105
|
-
.str { color: #EECCCC; font-style: italic }
|
106
|
-
.re { color: #EECCCC; }
|
data/doc/rdoc/rubyfr.png
DELETED
Binary file
|
@@ -1,175 +0,0 @@
|
|
1
|
-
|
2
|
-
<!-- BEGIN: BODY -->
|
3
|
-
|
4
|
-
<div id="Capcode" title="Module: Capcode" class="panel">
|
5
|
-
|
6
|
-
|
7
|
-
<h2>Includes</h2>
|
8
|
-
<ul>
|
9
|
-
<li>Rack</li>
|
10
|
-
<li>Capcode::Helpers</li>
|
11
|
-
<li>Capcode::Views</li>
|
12
|
-
</ul>
|
13
|
-
|
14
|
-
|
15
|
-
<h2 class="ruled">Methods</h2>
|
16
|
-
<ul>
|
17
|
-
<li>
|
18
|
-
Public Class method:
|
19
|
-
<b>Route(*u)</b>
|
20
|
-
</li>
|
21
|
-
<li>
|
22
|
-
<p>
|
23
|
-
Add routes to a controller class
|
24
|
-
</p>
|
25
|
-
<pre>
|
26
|
-
module Capcode
|
27
|
-
class Hello < Route '/hello/(.*)', '/hello/([^#]*)#(.*)'
|
28
|
-
def get( arg1, arg2 )
|
29
|
-
...
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
</pre>
|
34
|
-
<p>
|
35
|
-
In the <tt>get</tt> method, you will receive the maximum of parameters
|
36
|
-
declared by the routes. In this example, you will receive 2 parameters. So
|
37
|
-
if you go to <tt>/hello/world#friend</tt> then <tt>arg1</tt> will be set to
|
38
|
-
<tt>world</tt> and <tt>arg2</tt> will be set to <tt>friend</tt>. Now if you
|
39
|
-
go to <tt>/hello/you</tt>, then <tt>arg1</tt> will be set to <tt>you</tt>
|
40
|
-
and <tt>arg2</tt> will be set to <tt>nil</tt>
|
41
|
-
</p>
|
42
|
-
<p>
|
43
|
-
If the regexp in the route does not match, all arguments will be
|
44
|
-
<tt>nil</tt>
|
45
|
-
</p>
|
46
|
-
</li>
|
47
|
-
</ul>
|
48
|
-
<ul>
|
49
|
-
<li>
|
50
|
-
Public Class method:
|
51
|
-
<b>env()</b>
|
52
|
-
</li>
|
53
|
-
<li>
|
54
|
-
<p>
|
55
|
-
Hash containing all the environment variables
|
56
|
-
</p>
|
57
|
-
</li>
|
58
|
-
</ul>
|
59
|
-
<ul>
|
60
|
-
<li>
|
61
|
-
Public Class method:
|
62
|
-
<b>map( r ) {|| ...}</b>
|
63
|
-
</li>
|
64
|
-
<li>
|
65
|
-
<p>
|
66
|
-
This method help you to <a href="Capcode.html#M000007">map</a> and URL to a
|
67
|
-
Rack or What you want Helper
|
68
|
-
</p>
|
69
|
-
<pre>
|
70
|
-
Capcode.map( "/file" ) do
|
71
|
-
Rack::File.new( "." )
|
72
|
-
end
|
73
|
-
</pre>
|
74
|
-
</li>
|
75
|
-
</ul>
|
76
|
-
<ul>
|
77
|
-
<li>
|
78
|
-
Public Class method:
|
79
|
-
<b>params()</b>
|
80
|
-
</li>
|
81
|
-
<li>
|
82
|
-
<p>
|
83
|
-
Hash containing all the <a href="Capcode.html#M000005">request</a>
|
84
|
-
parameters (GET or POST)
|
85
|
-
</p>
|
86
|
-
</li>
|
87
|
-
</ul>
|
88
|
-
<ul>
|
89
|
-
<li>
|
90
|
-
Public Class method:
|
91
|
-
<b>request()</b>
|
92
|
-
</li>
|
93
|
-
<li>
|
94
|
-
<p>
|
95
|
-
Return the Rack::Request object
|
96
|
-
</p>
|
97
|
-
</li>
|
98
|
-
</ul>
|
99
|
-
<ul>
|
100
|
-
<li>
|
101
|
-
Public Class method:
|
102
|
-
<b>response()</b>
|
103
|
-
</li>
|
104
|
-
<li>
|
105
|
-
<p>
|
106
|
-
Return the Rack::Response object
|
107
|
-
</p>
|
108
|
-
</li>
|
109
|
-
</ul>
|
110
|
-
<ul>
|
111
|
-
<li>
|
112
|
-
Public Class method:
|
113
|
-
<b>run( args = {} ) {|self| ...}</b>
|
114
|
-
</li>
|
115
|
-
<li>
|
116
|
-
<p>
|
117
|
-
Start your application.
|
118
|
-
</p>
|
119
|
-
<p>
|
120
|
-
Options :
|
121
|
-
</p>
|
122
|
-
<ul>
|
123
|
-
<li><tt>:port</tt> = Listen port
|
124
|
-
|
125
|
-
</li>
|
126
|
-
<li><tt>:host</tt> = Listen host
|
127
|
-
|
128
|
-
</li>
|
129
|
-
<li><tt>:server</tt> = Server type (webrick or mongrel)
|
130
|
-
|
131
|
-
</li>
|
132
|
-
<li><tt>:log</tt> = Output logfile (default: STDOUT)
|
133
|
-
|
134
|
-
</li>
|
135
|
-
<li><tt>:<a href="Capcode.html#M000004">session</a></tt> = Session parameters.
|
136
|
-
See Rack::Session for more informations
|
137
|
-
|
138
|
-
</li>
|
139
|
-
<li><tt>:pid</tt> = PID file (default: $0.pid)
|
140
|
-
|
141
|
-
</li>
|
142
|
-
<li><tt>:daemonize</tt> = Daemonize application (default: false)
|
143
|
-
|
144
|
-
</li>
|
145
|
-
<li><tt>:db_config</tt> = database configuration file (default: database.yml)
|
146
|
-
|
147
|
-
</li>
|
148
|
-
<li><tt>:root</tt> = root directory (default: "." — relative to
|
149
|
-
the working directory)
|
150
|
-
|
151
|
-
</li>
|
152
|
-
<li><tt>:working_directory</tt> = Working directory (default: directory of the
|
153
|
-
main.rb)
|
154
|
-
|
155
|
-
</li>
|
156
|
-
</ul>
|
157
|
-
</li>
|
158
|
-
</ul>
|
159
|
-
<ul>
|
160
|
-
<li>
|
161
|
-
Public Class method:
|
162
|
-
<b>session()</b>
|
163
|
-
</li>
|
164
|
-
<li>
|
165
|
-
<p>
|
166
|
-
Hash <a href="Capcode.html#M000004">session</a>
|
167
|
-
</p>
|
168
|
-
</li>
|
169
|
-
</ul>
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
</div>
|
174
|
-
|
175
|
-
<!-- BEGIN: BODY -->
|
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
<!-- BEGIN: BODY -->
|
3
|
-
|
4
|
-
<div id="Capcode__HTTPError" title="Class: Capcode::HTTPError" class="panel">
|
5
|
-
|
6
|
-
|
7
|
-
<h2>Includes</h2>
|
8
|
-
<ul>
|
9
|
-
<li>Rack</li>
|
10
|
-
<li>Capcode::Helpers</li>
|
11
|
-
<li>Capcode::Views</li>
|
12
|
-
</ul>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<!-- BEGIN: BODY -->
|
@@ -1,153 +0,0 @@
|
|
1
|
-
|
2
|
-
<!-- BEGIN: BODY -->
|
3
|
-
|
4
|
-
<div id="Capcode__Helpers" title="Module: Capcode::Helpers" class="panel">
|
5
|
-
|
6
|
-
|
7
|
-
<h2>Includes</h2>
|
8
|
-
<ul>
|
9
|
-
<li>Rack</li>
|
10
|
-
<li>Capcode::Helpers</li>
|
11
|
-
<li>Capcode::Views</li>
|
12
|
-
</ul>
|
13
|
-
|
14
|
-
|
15
|
-
<h2 class="ruled">Methods</h2>
|
16
|
-
<ul>
|
17
|
-
<li>
|
18
|
-
Public Instance method:
|
19
|
-
<b>URL( klass, *a )</b>
|
20
|
-
</li>
|
21
|
-
<li>
|
22
|
-
<p>
|
23
|
-
Builds an <a href="Helpers.html#M000012">URL</a> route to a controller or a
|
24
|
-
path
|
25
|
-
</p>
|
26
|
-
<p>
|
27
|
-
if you declare the controller Hello :
|
28
|
-
</p>
|
29
|
-
<pre>
|
30
|
-
module Capcode
|
31
|
-
class Hello < Route '/hello/(.*)'
|
32
|
-
...
|
33
|
-
end
|
34
|
-
end
|
35
|
-
</pre>
|
36
|
-
<p>
|
37
|
-
then
|
38
|
-
</p>
|
39
|
-
<pre>
|
40
|
-
URL( Hello, "you" ) # => /hello/you
|
41
|
-
</pre>
|
42
|
-
</li>
|
43
|
-
</ul>
|
44
|
-
<ul>
|
45
|
-
<li>
|
46
|
-
Public Instance method:
|
47
|
-
<b>content_for( x ) {|| ...}</b>
|
48
|
-
</li>
|
49
|
-
<li>
|
50
|
-
<p>
|
51
|
-
Calling <a href="Helpers.html#M000013">content_for</a> stores a block of
|
52
|
-
markup in an identifier.
|
53
|
-
</p>
|
54
|
-
</li>
|
55
|
-
</ul>
|
56
|
-
<ul>
|
57
|
-
<li>
|
58
|
-
Public Instance method:
|
59
|
-
<b>json( d )</b>
|
60
|
-
</li>
|
61
|
-
<li>
|
62
|
-
<p>
|
63
|
-
Help you to return a JSON response
|
64
|
-
</p>
|
65
|
-
<pre>
|
66
|
-
module Capcode
|
67
|
-
class JsonResponse < Route '/json/([^\/]*)/(.*)'
|
68
|
-
def get( arg1, arg2 )
|
69
|
-
json( { :1 => arg1, :2 => arg2 })
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
</pre>
|
74
|
-
</li>
|
75
|
-
</ul>
|
76
|
-
<ul>
|
77
|
-
<li>
|
78
|
-
Public Instance method:
|
79
|
-
<b>redirect( klass, *a )</b>
|
80
|
-
</li>
|
81
|
-
<li>
|
82
|
-
<p>
|
83
|
-
Send a <a href="Helpers.html#M000011">redirect</a> response
|
84
|
-
</p>
|
85
|
-
<pre>
|
86
|
-
module Capcode
|
87
|
-
class Hello < Route '/hello/(.*)'
|
88
|
-
def get( you )
|
89
|
-
if you.nil?
|
90
|
-
redirect( WhoAreYou )
|
91
|
-
else
|
92
|
-
...
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
</pre>
|
98
|
-
</li>
|
99
|
-
</ul>
|
100
|
-
<ul>
|
101
|
-
<li>
|
102
|
-
Public Instance method:
|
103
|
-
<b>render( h )</b>
|
104
|
-
</li>
|
105
|
-
<li>
|
106
|
-
<p>
|
107
|
-
Render a view
|
108
|
-
</p>
|
109
|
-
<p>
|
110
|
-
<a href="Helpers.html#M000009">render</a>‘s parameter can be a Hash
|
111
|
-
or a string. Passing a string is equivalent to do
|
112
|
-
</p>
|
113
|
-
<pre>
|
114
|
-
render( :text => string )
|
115
|
-
</pre>
|
116
|
-
<p>
|
117
|
-
If you want to use a specific renderer, use one of this options :
|
118
|
-
</p>
|
119
|
-
<ul>
|
120
|
-
<li>:markaby => :my_func : :my_func must be defined in <a
|
121
|
-
href="Views.html">Capcode::Views</a>
|
122
|
-
|
123
|
-
</li>
|
124
|
-
<li>:erb => :my_erb_file : this suppose that‘s my_erb_file.rhtml exist
|
125
|
-
in erb_path
|
126
|
-
|
127
|
-
</li>
|
128
|
-
<li>:haml => :my_haml_file : this suppose that‘s my_haml_file.rhtml
|
129
|
-
exist in haml_path
|
130
|
-
|
131
|
-
</li>
|
132
|
-
<li>:text => "my text"
|
133
|
-
|
134
|
-
</li>
|
135
|
-
<li>:<a href="Helpers.html#M000010">json</a> => MyObject : this suppose
|
136
|
-
that‘s MyObject respond to .to_json
|
137
|
-
|
138
|
-
</li>
|
139
|
-
</ul>
|
140
|
-
<p>
|
141
|
-
If you want to use a specific layout, you can specify it with option
|
142
|
-
</p>
|
143
|
-
<pre>
|
144
|
-
:layout
|
145
|
-
</pre>
|
146
|
-
</li>
|
147
|
-
</ul>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
</div>
|
152
|
-
|
153
|
-
<!-- BEGIN: BODY -->
|