Capcode 0.8.9 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +13 -1
- data/doc/rdoc/classes/Capcode.html +410 -545
- data/doc/rdoc/classes/Capcode/Configuration.html +263 -0
- data/doc/rdoc/classes/Capcode/Helpers.html +154 -345
- data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +42 -2
- data/doc/rdoc/files/lib/capcode/configuration_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/text_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode_rb.html +14 -1
- data/doc/rdoc/fr_class_index.html +1 -1
- data/doc/rdoc/fr_file_index.html +0 -13
- data/doc/rdoc/fr_method_index.html +12 -14
- data/examples/render-image.rb +1 -1
- data/examples/render-text.rb +4 -1
- data/examples/rest.rb +1 -0
- data/examples/sample.rb +5 -3
- data/examples/upload.rb +1 -0
- data/lib/capcode.rb +45 -61
- data/lib/capcode/configuration.rb +69 -34
- data/lib/capcode/render/text.rb +1 -1
- data/lib/capcode/version.rb +1 -1
- metadata +31 -106
- data/doc/rdoc/classes/Capcode/Mab.html +0 -118
- data/doc/rdoc/files/lib/capcode/render/binary_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/email_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/erb_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/haml_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/json_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/mustache_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/none_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/redirect_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/sass_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/static_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/webdav_rb.html +0 -124
- data/doc/rdoc/files/lib/capcode/render/xml_rb.html +0 -101
- data/examples/auth-webdav.rb +0 -29
- data/examples/blog-ar.rb +0 -81
- data/examples/blog-ar.yml +0 -3
- data/examples/blog-couchdb-run.rb +0 -10
- data/examples/blog-couchdb.rb +0 -314
- data/examples/blog-couchdb.ru +0 -12
- data/examples/blog-couchdb.yml +0 -2
- data/examples/blog-dm.rb +0 -63
- data/examples/blog-dm.yml +0 -2
- data/examples/blog-mongodb-run.rb +0 -10
- data/examples/blog-mongodb.rb +0 -304
- data/examples/blog-mongodb.yml +0 -3
- data/examples/blog-sq.rb +0 -82
- data/examples/blog-sq.yml +0 -3
- data/examples/mail/mail_html.rhtml +0 -1
- data/examples/mail/mail_text.rhtml +0 -1
- data/examples/mail/ok.rhtml +0 -1
- data/examples/mail/rubyfr.png +0 -0
- data/examples/mustache/with_class.mustache +0 -8
- data/examples/mustache/without_class.mustache +0 -1
- data/examples/render-binary.rb +0 -46
- data/examples/render-email.rb +0 -68
- data/examples/render-erb.rb +0 -19
- data/examples/render-haml_sass.rb +0 -26
- data/examples/render-json.rb +0 -13
- data/examples/render-markaby.rb +0 -29
- data/examples/render-mustache.rb +0 -30
- data/examples/render-redirect.rb +0 -19
- data/examples/render-static.rb +0 -21
- data/examples/render-static.ru +0 -19
- data/examples/render-use.rb +0 -32
- data/examples/render-webdav.rb +0 -26
- data/examples/render-xml.rb +0 -24
- data/examples/rss.rb +0 -48
- data/examples/static/coderay.css +0 -131
- data/examples/static/index.html +0 -24
- data/examples/test/index.html +0 -1
- data/lib/capcode/base/ar.rb +0 -54
- data/lib/capcode/base/couchdb.rb +0 -23
- data/lib/capcode/base/dm.rb +0 -33
- data/lib/capcode/base/mongodb.rb +0 -27
- data/lib/capcode/base/sq.rb +0 -58
- data/lib/capcode/render/binary.rb +0 -8
- data/lib/capcode/render/email.rb +0 -73
- data/lib/capcode/render/erb.rb +0 -59
- data/lib/capcode/render/haml.rb +0 -60
- data/lib/capcode/render/json.rb +0 -14
- data/lib/capcode/render/markaby.rb +0 -38
- data/lib/capcode/render/mustache.rb +0 -37
- data/lib/capcode/render/none.rb +0 -7
- data/lib/capcode/render/redirect.rb +0 -7
- data/lib/capcode/render/sass.rb +0 -48
- data/lib/capcode/render/static.rb +0 -14
- data/lib/capcode/render/webdav.rb +0 -49
- data/lib/capcode/render/xml.rb +0 -119
@@ -1,101 +0,0 @@
|
|
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>File: static.rb</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="fileHeader">
|
50
|
-
<h1>static.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/capcode/render/static.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Sep 04 16:14:35 +0200 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
</div>
|
74
|
-
|
75
|
-
|
76
|
-
</div>
|
77
|
-
|
78
|
-
|
79
|
-
<!-- if includes -->
|
80
|
-
|
81
|
-
<div id="section">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if method_list -->
|
91
|
-
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
|
96
|
-
<div id="validator-badges">
|
97
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
</body>
|
101
|
-
</html>
|
@@ -1,124 +0,0 @@
|
|
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>File: webdav.rb</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="fileHeader">
|
50
|
-
<h1>webdav.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/capcode/render/webdav.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Thu Nov 05 14:49:06 +0100 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
From rack_dav
|
74
|
-
</p>
|
75
|
-
|
76
|
-
</div>
|
77
|
-
|
78
|
-
<div id="requires-list">
|
79
|
-
<h3 class="section-bar">Required files</h3>
|
80
|
-
|
81
|
-
<div class="name-list">
|
82
|
-
builder
|
83
|
-
time
|
84
|
-
uri
|
85
|
-
rexml/document
|
86
|
-
webrick/httputils
|
87
|
-
rack_dav/builder_namespace
|
88
|
-
rack_dav/http_status
|
89
|
-
rack_dav/resource
|
90
|
-
rack_dav/file_resource
|
91
|
-
rack_dav/handler
|
92
|
-
rack_dav/controller
|
93
|
-
</div>
|
94
|
-
</div>
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
|
102
|
-
<!-- if includes -->
|
103
|
-
|
104
|
-
<div id="section">
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<!-- if method_list -->
|
114
|
-
|
115
|
-
|
116
|
-
</div>
|
117
|
-
|
118
|
-
|
119
|
-
<div id="validator-badges">
|
120
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
</body>
|
124
|
-
</html>
|
@@ -1,101 +0,0 @@
|
|
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>File: xml.rb</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="fileHeader">
|
50
|
-
<h1>xml.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/capcode/render/xml.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sun Jul 19 19:34:59 +0200 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
</div>
|
74
|
-
|
75
|
-
|
76
|
-
</div>
|
77
|
-
|
78
|
-
|
79
|
-
<!-- if includes -->
|
80
|
-
|
81
|
-
<div id="section">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if method_list -->
|
91
|
-
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
|
96
|
-
<div id="validator-badges">
|
97
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
</body>
|
101
|
-
</html>
|
data/examples/auth-webdav.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
$:.unshift( "../lib" )
|
2
|
-
require 'capcode'
|
3
|
-
require 'capcode/render/webdav'
|
4
|
-
|
5
|
-
module Capcode
|
6
|
-
|
7
|
-
# Render file from /Users/greg/temp !!!
|
8
|
-
class WebDav < Route '/temp'
|
9
|
-
def get
|
10
|
-
http_authentication( :type => :digest, :realm => "My WebDAV Directory !!!" ) {
|
11
|
-
{"greg" => "toto"}
|
12
|
-
}
|
13
|
-
render :webdav => "/Users/greg"
|
14
|
-
end
|
15
|
-
|
16
|
-
def method_missing(id, *a, &b)
|
17
|
-
get
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Index < Route '/'
|
22
|
-
def get
|
23
|
-
render "WebDav server acces : <a href='#{URL(Capcode::WebDav)}'>#{URL(Capcode::WebDav)}</a>"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
Capcode.run( )
|
data/examples/blog-ar.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
$:.unshift( "../lib" )
|
2
|
-
require 'rubygems'
|
3
|
-
require 'capcode'
|
4
|
-
require 'capcode/base/ar'
|
5
|
-
|
6
|
-
class Basic < Capcode::Model 1.0
|
7
|
-
def self.up
|
8
|
-
create_table :stories do |t|
|
9
|
-
t.string :title
|
10
|
-
t.string :body
|
11
|
-
t.string :date
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class UpdateBasic < Capcode::Model 1.1
|
17
|
-
def self.up
|
18
|
-
create_table :users do |t|
|
19
|
-
t.string :name
|
20
|
-
t.string :password
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.down
|
25
|
-
drop_table :users
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Story < Capcode::Base
|
30
|
-
include Capcode::Resource
|
31
|
-
end
|
32
|
-
|
33
|
-
module Capcode
|
34
|
-
class HTTPError
|
35
|
-
def r404(f)
|
36
|
-
"Pas glop !!! #{f} est inconnu !!!"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Index < Route '/'
|
41
|
-
def get
|
42
|
-
r = "<html><body>"
|
43
|
-
|
44
|
-
story = Story.all
|
45
|
-
|
46
|
-
story.each do |s|
|
47
|
-
r += "<h2>#{s.title}</h2><small>#{s.date} - <a href='#{URL( Remove, s.id )}'>Delete this entry</a></small><p>#{s.body}</p>"
|
48
|
-
end
|
49
|
-
|
50
|
-
r+"<hr /><a href='#{URL(Add)}'>Add a new entry</a></body></html>"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
class Remove < Route '/remove/([^\/]*)'
|
55
|
-
def get( id )
|
56
|
-
Story.delete(id)
|
57
|
-
redirect( Index )
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class Add < Route '/add'
|
62
|
-
def get
|
63
|
-
'
|
64
|
-
<html><body>
|
65
|
-
<h1>Add a new entry</h1>
|
66
|
-
<form method="POST">
|
67
|
-
Titre : <input type="text" name="title"><br />
|
68
|
-
<textarea name="body"></textarea><br />
|
69
|
-
<input type="submit">
|
70
|
-
</form>
|
71
|
-
</body></html>
|
72
|
-
'
|
73
|
-
end
|
74
|
-
def post
|
75
|
-
Story.new( :title => params['title'], :body => params['body'], :date => Time.now.to_s ).save
|
76
|
-
redirect( Index )
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
Capcode.run( :port => 3001, :host => "localhost", :db_config => "blog-ar.yml" )
|
data/examples/blog-ar.yml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'blog-couchdb'
|
2
|
-
|
3
|
-
Capcode.run( :port => 3001, :host => "localhost", :db_config => "blog-couchdb.yml" ) do |c|
|
4
|
-
admin = User.find_by_login( "admin" )
|
5
|
-
if admin.nil?
|
6
|
-
puts "Create admin user..."
|
7
|
-
admin = User.create( :login => "admin", :passwd => "admin" )
|
8
|
-
end
|
9
|
-
puts "Admin user : \n\tlogin = #{admin.login}\n\tpassword = #{admin.passwd}"
|
10
|
-
end
|