public
Description: OBSOLETE! PLEASE SEE http://github.com/radiant/radiant
Homepage: http://www.radiantcms.org/
Clone URL: git://github.com/seancribbs/radiant.git
Search Repo:
wiki: got it running on http://wiki.radiantcms.org

git-svn-id: http://svn.radiantcms.org/radiant/trunk@458 
6226cccd-6db4-da11-80d6-0014220fd306
jlong (author)
Thu Jun 21 20:40:25 -0700 2007
commit  ac6361da79fdba97ff8b11414d42fb9f18dc67c3
tree    41a56ad75d61e319f3b2437edc6ce9952841e9d7
parent  478abbc8a2f281b48c214543db3b98b4e4e72c31
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
0
@@ -1 +1,93 @@
0
+#!/usr/local/bin/ruby
0
+
0
+JUNEBUG_ROOT = ENV['JUNEBUG_ROOT'] ||= File.expand_path(File.dirname(__FILE__) + '/../') + '/'
0
+
0
+%w(
0
+ .
0
+ vendor/junebug/lib
0
+ vendor/camping/lib
0
+ vendor/activesupport/lib
0
+ vendor/markaby/lib
0
+ vendor/fcgi
0
+ vendor/activerecord/lib
0
+).reverse.each { |dir| $:.unshift(JUNEBUG_ROOT + dir) }
0
+
0
+require 'camping/fastcgi'
0
+require 'junebug/config'
0
+require 'junebug'
0
+
0
+class Camping::FastCGI
0
+ def start
0
+ FCGI.each do |req|
0
+ dir, app = nil
0
+ begin
0
+ root, path = "/"
0
+ if ENV['FORCE_ROOT'] and ENV['FORCE_ROOT'].to_i == 1
0
+ path, qs = req.env['REQUEST_URI'].to_s.split('?', 2)
0
+ req.env['QUERY_STRING'] = qs
0
+ else
0
+ root = req.env['SCRIPT_NAME']
0
+ path = req.env['PATH_INFO']
0
+ end
0
+
0
+ dir, app = @mounts.max { |a,b| match(path, a[0]) <=> match(path, b[0]) }
0
+ unless dir and app
0
+ dir, app = '/', Camping
0
+ end
0
+ yield dir, app if block_given?
0
+
0
+ req.env['SERVER_SCRIPT_NAME'] = req.env['SCRIPT_NAME']
0
+ req.env['SERVER_PATH_INFO'] = req.env['PATH_INFO']
0
+ req.env['SCRIPT_NAME'] = File.join(root, dir)
0
+ req.env['PATH_INFO'] = path.gsub(/^#{dir}/, '')
0
+
0
+ controller = app.run(req.in, req.env)
0
+ sendfile = nil
0
+ headers = {}
0
+ controller.headers.each do |k, v|
0
+ if k =~ /^X-SENDFILE$/i and !ENV['SERVER_X_SENDFILE']
0
+ sendfile = v
0
+ else
0
+ headers[k] = v
0
+ end
0
+ end
0
+
0
+ body = controller.body
0
+ controller.body = ""
0
+ controller.headers = headers
0
+
0
+ req.out << controller.to_s
0
+ if sendfile
0
+ File.open(sendfile, "rb") do |f|
0
+ while chunk = f.read(CHUNK_SIZE) and chunk.length > 0
0
+ req.out << chunk
0
+ end
0
+ end
0
+ elsif body.respond_to? :read
0
+ while chunk = body.read(CHUNK_SIZE) and chunk.length > 0
0
+ req.out << chunk
0
+ end
0
+ body.close if body.respond_to? :close
0
+ else
0
+ req.out << body.to_s
0
+ end
0
+ rescue Exception => e
0
+ req.out << "Content-Type: text/html\r\n\r\n" +
0
+ "<h1>Camping Problem!</h1>" +
0
+ "<h2><strong>#{root}</strong>#{path}</h2>" +
0
+ "<h3>#{e.class} #{esc e.message}</h3>" +
0
+ "<ul>" + e.backtrace.map { |bt| "<li>#{esc bt}</li>" }.join + "</ul>" +
0
+ "<hr /><p>#{req.env.inspect}</p>"
0
+ ensure
0
+ req.finish
0
+ end
0
+ end
0
+ end
0
+end
0
+
0
+FileUtils.cd ENV['JUNEBUG_ROOT'] do
0
+ Junebug.connect
0
+ Junebug.create
0
+end
0
+Camping::FastCGI.start(Junebug)

Comments

    No one has commented yet.