picnic 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Manifest.txt +30 -13
- data/Rakefile +2 -0
- data/lib/picnic.rb +5 -120
- data/lib/picnic/authentication.rb +40 -4
- data/lib/picnic/cli.rb +86 -43
- data/lib/picnic/conf.rb +45 -43
- data/lib/picnic/logger.rb +41 -0
- data/lib/picnic/server.rb +99 -0
- data/lib/picnic/version.rb +2 -2
- data/picnic.gemspec +44 -0
- data/vendor/{camping-1.5.180 → camping-2.0.20090212}/CHANGELOG +17 -10
- data/vendor/{camping-1.5.180 → camping-2.0.20090212}/COPYING +0 -0
- data/vendor/{camping-1.5.180 → camping-2.0.20090212}/README +2 -2
- data/vendor/{camping-1.5.180 → camping-2.0.20090212}/Rakefile +62 -5
- data/vendor/camping-2.0.20090212/bin/camping +99 -0
- data/vendor/camping-2.0.20090212/doc/camping.1.gz +0 -0
- data/vendor/camping-2.0.20090212/examples/README +5 -0
- data/vendor/camping-2.0.20090212/examples/blog.rb +375 -0
- data/vendor/camping-2.0.20090212/examples/campsh.rb +629 -0
- data/vendor/camping-2.0.20090212/examples/tepee.rb +242 -0
- data/vendor/camping-2.0.20090212/extras/Camping.gif +0 -0
- data/vendor/camping-2.0.20090212/extras/flipbook_rdoc.rb +491 -0
- data/vendor/camping-2.0.20090212/extras/permalink.gif +0 -0
- data/vendor/{camping-1.5.180 → camping-2.0.20090212}/lib/camping-unabridged.rb +168 -294
- data/vendor/camping-2.0.20090212/lib/camping.rb +54 -0
- data/vendor/{camping-1.5.180/lib/camping/db.rb → camping-2.0.20090212/lib/camping/ar.rb} +4 -4
- data/vendor/{camping-1.5.180/lib/camping → camping-2.0.20090212/lib/camping/ar}/session.rb +23 -14
- data/vendor/camping-2.0.20090212/lib/camping/mab.rb +26 -0
- data/vendor/camping-2.0.20090212/lib/camping/reloader.rb +163 -0
- data/vendor/camping-2.0.20090212/lib/camping/server.rb +158 -0
- data/vendor/camping-2.0.20090212/lib/camping/session.rb +74 -0
- data/vendor/camping-2.0.20090212/setup.rb +1551 -0
- data/vendor/camping-2.0.20090212/test/apps/env_debug.rb +65 -0
- data/vendor/camping-2.0.20090212/test/apps/forms.rb +95 -0
- data/vendor/camping-2.0.20090212/test/apps/misc.rb +86 -0
- data/vendor/camping-2.0.20090212/test/apps/sessions.rb +38 -0
- data/vendor/camping-2.0.20090212/test/test_camping.rb +54 -0
- metadata +43 -16
- data/lib/picnic/postambles.rb +0 -292
- data/lib/picnic/utils.rb +0 -36
- data/vendor/camping-1.5.180/lib/camping.rb +0 -57
- data/vendor/camping-1.5.180/lib/camping/fastcgi.rb +0 -244
- data/vendor/camping-1.5.180/lib/camping/reloader.rb +0 -163
- data/vendor/camping-1.5.180/lib/camping/webrick.rb +0 -65
@@ -1,65 +0,0 @@
|
|
1
|
-
# == About camping/webrick.rb
|
2
|
-
#
|
3
|
-
# For many who have Ruby installed, Camping and WEBrick is a great option.
|
4
|
-
# It's definitely the easiest configuration, however some performance is sacrificed.
|
5
|
-
# For better speed, check out Mongrel at http://mongrel.rubyforge.org/, which comes
|
6
|
-
# with Camping hooks and is supported by the Camping Tool.
|
7
|
-
require 'camping'
|
8
|
-
require 'webrick/httpservlet/abstract.rb'
|
9
|
-
|
10
|
-
module WEBrick
|
11
|
-
# WEBrick::CampingHandler is a very simple handle for hosting Camping apps in
|
12
|
-
# a WEBrick server. It's used much like any other WEBrick handler.
|
13
|
-
#
|
14
|
-
# == Mounting a Camping App
|
15
|
-
#
|
16
|
-
# Assuming Camping.goes(:Blog), the Blog application can be mounted alongside
|
17
|
-
# other WEBrick mounts.
|
18
|
-
#
|
19
|
-
# s = WEBrick::HTTPServer.new(:BindAddress => host, :Port => port)
|
20
|
-
# s.mount "/blog", WEBrick::CampingHandler, Blog
|
21
|
-
# s.mount_proc("/") { ... }
|
22
|
-
#
|
23
|
-
# == How Does it Compare?
|
24
|
-
#
|
25
|
-
# Compared to other handlers, WEBrick is well-equipped in terms of features.
|
26
|
-
#
|
27
|
-
# * The <tt>X-Sendfile</tt> header is supported, along with etags and
|
28
|
-
# modification time headers for the file served. Since this handler
|
29
|
-
# is a subclass of WEBrick::HTTPServlet::DefaultFileHandler, all of its
|
30
|
-
# logic is used.
|
31
|
-
# * IO is streaming up and down. When you upload a file, it is streamed to
|
32
|
-
# the server's filesystem. When you download a file, it is streamed to
|
33
|
-
# your browser.
|
34
|
-
#
|
35
|
-
# While WEBrick is a bit slower than Mongrel and FastCGI options, it's
|
36
|
-
# a decent choice, for sure!
|
37
|
-
class CampingHandler < WEBrick::HTTPServlet::DefaultFileHandler
|
38
|
-
# Creates a CampingHandler, which answers for the application within +klass+.
|
39
|
-
def initialize(server, klass)
|
40
|
-
super(server, klass)
|
41
|
-
@klass = klass
|
42
|
-
end
|
43
|
-
# Handler for WEBrick requests (also aliased as do_POST).
|
44
|
-
def service(req, resp)
|
45
|
-
controller = @klass.run((req.body and StringIO.new(req.body)), req.meta_vars)
|
46
|
-
resp.status = controller.status
|
47
|
-
@local_path = nil
|
48
|
-
controller.headers.each do |k, v|
|
49
|
-
if k =~ /^X-SENDFILE$/i
|
50
|
-
@local_path = v
|
51
|
-
else
|
52
|
-
[*v].each do |vi|
|
53
|
-
resp[k] = vi
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
if @local_path
|
59
|
-
do_GET(req, resp)
|
60
|
-
else
|
61
|
-
resp.body = controller.body.to_s
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|