Capcode 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/doc/rdoc/classes/Capcode.html +10 -5
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +13 -1
- data/doc/rdoc/files/lib/capcode/configuration_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/binary_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/render/email_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/mustache_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/none_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/render/redirect_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode_rb.html +1 -1
- data/examples/blog-mongodb-run.rb +10 -0
- data/examples/blog-mongodb.rb +304 -0
- data/examples/blog-mongodb.yml +3 -0
- data/examples/render-markaby.rb +3 -1
- data/examples/render-use.rb +1 -0
- data/examples/soapbox/README.rdoc +23 -0
- data/examples/soapbox/public/jquery.js +19 -0
- data/examples/soapbox/public/soapbox.js +100 -0
- data/examples/soapbox/public/style.css +43 -0
- data/examples/soapbox/soapbox-client.rb +248 -0
- data/examples/soapbox/soapbox.rb +19 -0
- data/examples/soapbox/views/index.rhtml +50 -0
- data/examples/static/coderay.css +1 -1
- data/lib/capcode.rb +6 -1
- data/lib/capcode/base/mongodb.rb +27 -0
- data/lib/capcode/configuration.rb +1 -1
- data/lib/capcode/render/markaby.rb +7 -2
- data/lib/capcode/version.rb +1 -1
- metadata +26 -4
@@ -0,0 +1,50 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Faye demo: chat client</title>
|
7
|
+
<link rel="stylesheet" href="/public/style.css" type="text/css" media="screen">
|
8
|
+
<script src="/public/jquery.js" type="text/javascript"></script>
|
9
|
+
<script src="/comet.js" type="text/javascript"></script>
|
10
|
+
<script src="/public/soapbox.js" type="text/javascript"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="container">
|
14
|
+
|
15
|
+
<h1><em>Soapbox</em> | a Twitter-style chat app</h1>
|
16
|
+
|
17
|
+
<form id="enterUsername">
|
18
|
+
<label for="username">Pick a username</label>
|
19
|
+
<input type="text" name="username" id="username">
|
20
|
+
<input type="submit" value="Go">
|
21
|
+
</form>
|
22
|
+
|
23
|
+
<div id="app">
|
24
|
+
<form id="addFollowee">
|
25
|
+
<label for="followee">Follow</label>
|
26
|
+
<input type="text" name="followee" id="followee">
|
27
|
+
<input type="submit" value="Go">
|
28
|
+
</form>
|
29
|
+
|
30
|
+
<form id="postMessage">
|
31
|
+
<label for="message">Post a message</label><br>
|
32
|
+
<textarea name="message" id="message" rows="3" cols="40"></textarea>
|
33
|
+
<input type="submit" value="Go">
|
34
|
+
</form>
|
35
|
+
|
36
|
+
<ul id="stream">
|
37
|
+
</ul>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<script type="text/javascript">
|
41
|
+
Comet = new Faye.Client('/comet');
|
42
|
+
Comet.connect();
|
43
|
+
|
44
|
+
Soapbox.init(Comet);
|
45
|
+
</script>
|
46
|
+
|
47
|
+
</div>
|
48
|
+
</body>
|
49
|
+
</html>
|
50
|
+
|
data/examples/static/coderay.css
CHANGED
data/lib/capcode.rb
CHANGED
@@ -724,7 +724,7 @@ module Capcode
|
|
724
724
|
end
|
725
725
|
|
726
726
|
# Start server
|
727
|
-
case conf[:server]
|
727
|
+
case conf[:server].to_s
|
728
728
|
when "mongrel"
|
729
729
|
puts "** Starting Mongrel on #{conf[:host]}:#{conf[:port]}"
|
730
730
|
Rack::Handler::Mongrel.run( app, {:Port => conf[:port], :Host => conf[:host]} ) { |server|
|
@@ -735,6 +735,11 @@ module Capcode
|
|
735
735
|
Rack::Handler::WEBrick.run( app, {:Port => conf[:port], :BindAddress => conf[:host]} ) { |server|
|
736
736
|
trap "SIGINT", proc { server.shutdown }
|
737
737
|
}
|
738
|
+
when "thin"
|
739
|
+
puts "** Starting Thin on #{conf[:host]}:#{conf[:port]}"
|
740
|
+
Rack::Handler::Thin.run( app, {:Port => conf[:port], :Host => conf[:host]} ) { |server|
|
741
|
+
trap "SIGINT", proc { server.stop }
|
742
|
+
}
|
738
743
|
end
|
739
744
|
end
|
740
745
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
begin
|
3
|
+
require 'mongoid'
|
4
|
+
rescue LoadError => e
|
5
|
+
raise MissingLibrary, "Mongoid could not be loaded (is it installed?): #{e.message}"
|
6
|
+
end
|
7
|
+
require 'yaml'
|
8
|
+
require 'logger'
|
9
|
+
|
10
|
+
module Capcode
|
11
|
+
module Resource
|
12
|
+
end
|
13
|
+
|
14
|
+
Base = Mongoid::Document
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def db_connect( dbfile, logfile )
|
18
|
+
dbconfig = YAML::load(File.open(dbfile)).keys_to_sym
|
19
|
+
|
20
|
+
connection = Mongo::Connection.new(dbconfig[:host], dbconfig[:port])
|
21
|
+
Mongoid.database = connection.db(dbconfig[:database])
|
22
|
+
if dbconfig[:username]
|
23
|
+
Mongoid.database.authenticate(dbconfig[:username], dbconfig[:password])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,7 +5,7 @@ module Capcode
|
|
5
5
|
# Options :
|
6
6
|
# * <tt>:port</tt> = Listen port (default: 3000)
|
7
7
|
# * <tt>:host</tt> = Listen host (default: 0.0.0.0)
|
8
|
-
# * <tt>:server</tt> = Server type (webrick or
|
8
|
+
# * <tt>:server</tt> = Server type (webrick, mongrel or thin)
|
9
9
|
# * <tt>:log</tt> = Output logfile (default: STDOUT)
|
10
10
|
# * <tt>:session</tt> = Session parameters. See Rack::Session for more informations
|
11
11
|
# * <tt>:pid</tt> = PID file (default: $0.pid)
|
@@ -16,10 +16,15 @@ module Capcode
|
|
16
16
|
f = f.to_s
|
17
17
|
layout = opts.delete(:layout)||:layout
|
18
18
|
|
19
|
-
|
19
|
+
assigns = {}
|
20
|
+
self.instance_variables.delete_if {|x| ["@response", "@env", "@request"].include?(x) }.each do |ivar|
|
21
|
+
assigns[ivar.gsub( /^@/, "" )] = self.instance_variable_get(ivar)
|
22
|
+
end
|
23
|
+
|
24
|
+
__mab = Mab.new(assigns.merge( opts ), self) {
|
20
25
|
if self.respond_to?(layout)
|
21
26
|
self.send(layout.to_s) { |*args|
|
22
|
-
|
27
|
+
# @@__ARGS__ = args
|
23
28
|
Capcode::Helpers.args = args
|
24
29
|
self.send(f)
|
25
30
|
}
|
data/lib/capcode/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Capcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Gr\xC3\xA9goire Lejeune"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-21 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,10 +78,15 @@ files:
|
|
78
78
|
- doc/rdoc/files/lib/capcode/base/db_rb.html
|
79
79
|
- doc/rdoc/files/lib/capcode/configuration_rb.html
|
80
80
|
- doc/rdoc/files/lib/capcode/helpers/auth_rb.html
|
81
|
+
- doc/rdoc/files/lib/capcode/render/binary_rb.html
|
82
|
+
- doc/rdoc/files/lib/capcode/render/email_rb.html
|
81
83
|
- doc/rdoc/files/lib/capcode/render/erb_rb.html
|
82
84
|
- doc/rdoc/files/lib/capcode/render/haml_rb.html
|
83
85
|
- doc/rdoc/files/lib/capcode/render/json_rb.html
|
84
86
|
- doc/rdoc/files/lib/capcode/render/markaby_rb.html
|
87
|
+
- doc/rdoc/files/lib/capcode/render/mustache_rb.html
|
88
|
+
- doc/rdoc/files/lib/capcode/render/none_rb.html
|
89
|
+
- doc/rdoc/files/lib/capcode/render/redirect_rb.html
|
85
90
|
- doc/rdoc/files/lib/capcode/render/sass_rb.html
|
86
91
|
- doc/rdoc/files/lib/capcode/render/static_rb.html
|
87
92
|
- doc/rdoc/files/lib/capcode/render/text_rb.html
|
@@ -98,6 +103,7 @@ files:
|
|
98
103
|
- lib/capcode/base/couchdb.rb
|
99
104
|
- lib/capcode/base/db.rb
|
100
105
|
- lib/capcode/base/dm.rb
|
106
|
+
- lib/capcode/base/mongodb.rb
|
101
107
|
- lib/capcode/base/sq.rb
|
102
108
|
- lib/capcode/configuration.rb
|
103
109
|
- lib/capcode/core_ext.rb
|
@@ -129,6 +135,9 @@ files:
|
|
129
135
|
- examples/blog-couchdb.yml
|
130
136
|
- examples/blog-dm.rb
|
131
137
|
- examples/blog-dm.yml
|
138
|
+
- examples/blog-mongodb-run.rb
|
139
|
+
- examples/blog-mongodb.rb
|
140
|
+
- examples/blog-mongodb.yml
|
132
141
|
- examples/blog-sq.rb
|
133
142
|
- examples/blog-sq.yml
|
134
143
|
- examples/erb/cf.rhtml
|
@@ -167,6 +176,13 @@ files:
|
|
167
176
|
- examples/rss.rb
|
168
177
|
- examples/sample.rb
|
169
178
|
- examples/session.rb
|
179
|
+
- examples/soapbox/public/jquery.js
|
180
|
+
- examples/soapbox/public/soapbox.js
|
181
|
+
- examples/soapbox/public/style.css
|
182
|
+
- examples/soapbox/README.rdoc
|
183
|
+
- examples/soapbox/soapbox-client.rb
|
184
|
+
- examples/soapbox/soapbox.rb
|
185
|
+
- examples/soapbox/views/index.rhtml
|
170
186
|
- examples/static/coderay.css
|
171
187
|
- examples/static/index.html
|
172
188
|
- examples/test/index.html
|
@@ -185,11 +201,17 @@ post_install_message: |+
|
|
185
201
|
If you want to use WebDAV renderer, you must install rack_dav.
|
186
202
|
If you want to use Mail renderer, you must install mail.
|
187
203
|
|
188
|
-
If
|
204
|
+
If you want to use ActiveRecord, you must install active_record.
|
205
|
+
If you want to use DataMapper, you must install dm-core.
|
206
|
+
If you want to use Sequel, you must install sequel.
|
207
|
+
If you want to use CouchDB, you must install couch_foo.
|
208
|
+
If you want to use MongoDB, you must install mongoid.
|
209
|
+
|
210
|
+
For more information about Capcode, see
|
189
211
|
http://capcode.rubyforge.org
|
190
212
|
|
191
213
|
You can also read the Capcode book (fr) at
|
192
|
-
http://algorithmique.net/capcode
|
214
|
+
http://algorithmique.net/capcode.html
|
193
215
|
|
194
216
|
rdoc_options:
|
195
217
|
- --quiet
|