ramaze 0.3.5 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. data/Rakefile +5 -20
  2. data/bin/ramaze +0 -4
  3. data/doc/AUTHORS +5 -0
  4. data/doc/meta/announcement.txt +2 -1
  5. data/doc/tutorial/todolist.html +20 -21
  6. data/doc/tutorial/todolist.mkd +10 -9
  7. data/examples/blog/{src/controller.rb → controller/main.rb} +2 -0
  8. data/examples/blog/{src/model.rb → model/entry.rb} +0 -0
  9. data/examples/blog/spec/blog.rb +3 -3
  10. data/examples/blog/start.rb +2 -3
  11. data/examples/blog/view/edit.xhtml +17 -0
  12. data/examples/blog/view/index.xhtml +17 -0
  13. data/examples/blog/view/layout.xhtml +11 -0
  14. data/examples/blog/view/new.xhtml +16 -0
  15. data/examples/facebook.rb +15 -8
  16. data/examples/identity.rb +1 -1
  17. data/examples/memleak_detector.rb +1 -1
  18. data/examples/rammit/src/model.rb +1 -1
  19. data/examples/rapaste/controller/paste.rb +7 -7
  20. data/examples/rapaste/model/paste.rb +1 -3
  21. data/examples/rapaste/public/css/display.css +2 -1
  22. data/examples/rapaste/start.rb +2 -3
  23. data/examples/sourceview/sourceview.rb +1 -1
  24. data/examples/templates/template/external.tenjin +28 -0
  25. data/examples/templates/template_amrita2.rb +0 -3
  26. data/examples/templates/template_tenjin.rb +57 -0
  27. data/examples/todolist/spec/todolist.rb +13 -2
  28. data/examples/todolist/src/controller/main.rb +1 -1
  29. data/examples/todolist/template/index.xhtml +1 -1
  30. data/examples/wiktacular/spec/wiktacular.rb +18 -0
  31. data/examples/wiktacular/src/controller.rb +2 -2
  32. data/examples/wiktacular/src/model.rb +8 -2
  33. data/lib/proto/public/css/ramaze_error.css +4 -0
  34. data/lib/proto/public/dispatch.fcgi +11 -0
  35. data/lib/proto/spec/main.rb +1 -1
  36. data/lib/proto/start.ru +8 -0
  37. data/lib/proto/view/error.xhtml +2 -0
  38. data/lib/ramaze.rb +28 -5
  39. data/lib/ramaze/action.rb +9 -2
  40. data/lib/ramaze/action/render.rb +40 -24
  41. data/lib/ramaze/adapter.rb +10 -17
  42. data/lib/ramaze/adapter/base.rb +8 -12
  43. data/lib/ramaze/adapter/cgi.rb +14 -13
  44. data/lib/ramaze/adapter/ebb.rb +34 -0
  45. data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
  46. data/lib/ramaze/adapter/fcgi.rb +14 -14
  47. data/lib/ramaze/adapter/lsws.rb +15 -11
  48. data/lib/ramaze/adapter/mongrel.rb +2 -1
  49. data/lib/ramaze/adapter/scgi.rb +24 -0
  50. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
  51. data/lib/ramaze/adapter/thin.rb +4 -5
  52. data/lib/ramaze/adapter/webrick.rb +5 -5
  53. data/lib/ramaze/cache.rb +1 -1
  54. data/lib/ramaze/cache/memcached.rb +1 -1
  55. data/lib/ramaze/contrib.rb +70 -10
  56. data/lib/ramaze/contrib/auto_params.rb +1 -1
  57. data/lib/ramaze/contrib/email.rb +15 -15
  58. data/lib/ramaze/contrib/facebook.rb +2 -2
  59. data/lib/ramaze/contrib/facebook/facebook.rb +7 -4
  60. data/lib/ramaze/contrib/file_cache.rb +65 -0
  61. data/lib/ramaze/contrib/gettext.rb +56 -55
  62. data/lib/ramaze/contrib/profiling.rb +36 -0
  63. data/lib/ramaze/contrib/sequel_cache.rb +92 -0
  64. data/lib/ramaze/controller.rb +80 -47
  65. data/lib/ramaze/controller/error.rb +10 -5
  66. data/lib/ramaze/controller/resolve.rb +36 -48
  67. data/lib/ramaze/current.rb +70 -0
  68. data/lib/ramaze/{trinity → current}/request.rb +62 -15
  69. data/lib/ramaze/current/response.rb +19 -0
  70. data/lib/ramaze/{trinity → current}/session.rb +32 -110
  71. data/lib/ramaze/current/session/flash.rb +67 -0
  72. data/lib/ramaze/current/session/hash.rb +65 -0
  73. data/lib/ramaze/dispatcher.rb +1 -28
  74. data/lib/ramaze/dispatcher/action.rb +6 -3
  75. data/lib/ramaze/dispatcher/directory.rb +1 -1
  76. data/lib/ramaze/dispatcher/error.rb +26 -5
  77. data/lib/ramaze/dispatcher/file.rb +13 -2
  78. data/lib/ramaze/gestalt.rb +3 -1
  79. data/lib/ramaze/global.rb +6 -3
  80. data/lib/ramaze/global/globalstruct.rb +3 -1
  81. data/lib/ramaze/helper.rb +66 -20
  82. data/lib/ramaze/helper/aspect.rb +25 -17
  83. data/lib/ramaze/helper/auth.rb +4 -3
  84. data/lib/ramaze/helper/cache.rb +5 -4
  85. data/lib/ramaze/helper/cgi.rb +11 -9
  86. data/lib/ramaze/helper/flash.rb +28 -3
  87. data/lib/ramaze/helper/formatting.rb +1 -3
  88. data/lib/ramaze/helper/identity.rb +2 -3
  89. data/lib/ramaze/helper/inform.rb +7 -6
  90. data/lib/ramaze/helper/link.rb +15 -17
  91. data/lib/ramaze/helper/markaby.rb +2 -4
  92. data/lib/ramaze/helper/maruku.rb +1 -1
  93. data/lib/ramaze/helper/nitroform.rb +4 -4
  94. data/lib/ramaze/helper/pager.rb +4 -6
  95. data/lib/ramaze/helper/partial.rb +24 -21
  96. data/lib/ramaze/helper/redirect.rb +8 -5
  97. data/lib/ramaze/helper/{file.rb → sendfile.rb} +1 -3
  98. data/lib/ramaze/helper/sequel.rb +1 -3
  99. data/lib/ramaze/helper/stack.rb +1 -3
  100. data/lib/ramaze/helper/tagz.rb +19 -0
  101. data/lib/ramaze/helper/user.rb +63 -0
  102. data/lib/ramaze/inform.rb +2 -24
  103. data/lib/ramaze/log.rb +28 -0
  104. data/lib/ramaze/{inform → log}/analogger.rb +3 -3
  105. data/lib/ramaze/{inform → log}/growl.rb +2 -2
  106. data/lib/ramaze/{inform → log}/hub.rb +4 -6
  107. data/lib/ramaze/{inform → log}/informer.rb +4 -4
  108. data/lib/ramaze/{inform → log}/knotify.rb +2 -2
  109. data/lib/ramaze/log/logger.rb +22 -0
  110. data/lib/ramaze/{inform/informing.rb → log/logging.rb} +16 -16
  111. data/lib/ramaze/{inform → log}/syslog.rb +0 -0
  112. data/lib/ramaze/{inform → log}/xosd.rb +2 -2
  113. data/lib/ramaze/route.rb +64 -36
  114. data/lib/ramaze/snippets/array/put_within.rb +13 -0
  115. data/lib/ramaze/snippets/binding/locals.rb +13 -0
  116. data/lib/ramaze/snippets/kernel/__dir__.rb +10 -8
  117. data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
  118. data/lib/ramaze/snippets/kernel/constant.rb +1 -1
  119. data/lib/ramaze/snippets/object/pretty.rb +6 -0
  120. data/lib/ramaze/snippets/object/scope.rb +11 -0
  121. data/lib/ramaze/snippets/object/thread_accessor.rb +5 -0
  122. data/lib/ramaze/snippets/ordered_set.rb +1 -1
  123. data/lib/ramaze/snippets/proc/locals.rb +11 -0
  124. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +44 -0
  125. data/lib/ramaze/snippets/string/esc.rb +29 -0
  126. data/lib/ramaze/snippets/string/start_with.rb +7 -0
  127. data/lib/ramaze/snippets/string/unindent.rb +6 -1
  128. data/lib/ramaze/snippets/struct/values_at.rb +1 -5
  129. data/lib/ramaze/sourcereload.rb +16 -14
  130. data/lib/ramaze/spec.rb +1 -0
  131. data/lib/ramaze/spec/helper.rb +11 -3
  132. data/lib/ramaze/spec/helper/browser.rb +25 -1
  133. data/lib/ramaze/spec/helper/pretty_output.rb +11 -11
  134. data/lib/ramaze/template.rb +5 -4
  135. data/lib/ramaze/template/amrita2.rb +2 -3
  136. data/lib/ramaze/template/ezamar/element.rb +2 -3
  137. data/lib/ramaze/template/ezamar/morpher.rb +1 -2
  138. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  139. data/lib/ramaze/template/haml.rb +5 -2
  140. data/lib/ramaze/template/markaby.rb +2 -0
  141. data/lib/ramaze/template/tagz.rb +79 -0
  142. data/lib/ramaze/template/tenjin.rb +34 -0
  143. data/lib/ramaze/tool/create.rb +0 -3
  144. data/lib/ramaze/tool/localize.rb +107 -105
  145. data/lib/ramaze/tool/mime.rb +0 -2
  146. data/lib/ramaze/trinity.rb +1 -26
  147. data/lib/ramaze/version.rb +1 -1
  148. data/lib/vendor/bacon.rb +47 -41
  149. data/rake_tasks/conf.rake +18 -0
  150. data/rake_tasks/darcs.rake +5 -0
  151. data/rake_tasks/maintenance.rake +37 -24
  152. data/rake_tasks/spec.rake +1 -1
  153. data/spec/contrib/auto_params.rb +3 -1
  154. data/spec/contrib/profiling.rb +26 -0
  155. data/spec/examples/templates/template_redcloth.rb +1 -1
  156. data/spec/examples/templates/template_tenjin.rb +28 -0
  157. data/spec/helper.rb +0 -1
  158. data/spec/ramaze/action/layout.rb +28 -0
  159. data/spec/ramaze/controller/actionless_templates.rb +32 -0
  160. data/spec/ramaze/controller/template/other_wrapper.xhtml +1 -0
  161. data/spec/ramaze/controller/template_resolving.rb +37 -0
  162. data/spec/ramaze/{trinity → current}/request.rb +12 -2
  163. data/spec/ramaze/current/session.rb +97 -0
  164. data/spec/ramaze/dispatcher/directory.rb +2 -1
  165. data/spec/ramaze/dispatcher/file.rb +8 -3
  166. data/spec/ramaze/dispatcher/public/file name.txt +1 -0
  167. data/spec/ramaze/gestalt.rb +11 -0
  168. data/spec/ramaze/helper/aspect.rb +28 -22
  169. data/spec/ramaze/helper/cgi.rb +2 -2
  170. data/spec/ramaze/helper/flash.rb +33 -15
  171. data/spec/ramaze/helper/formatting.rb +2 -2
  172. data/spec/ramaze/helper/link.rb +46 -18
  173. data/spec/ramaze/helper/pager.rb +8 -5
  174. data/spec/ramaze/helper/partial.rb +8 -1
  175. data/spec/ramaze/helper/template/recursive_local_ivars.xhtml +7 -0
  176. data/spec/ramaze/helper/user.rb +46 -0
  177. data/spec/ramaze/{inform → log}/informer.rb +0 -0
  178. data/spec/ramaze/{inform → log}/syslog.rb +1 -1
  179. data/spec/ramaze/request.rb +14 -10
  180. data/spec/ramaze/route.rb +23 -0
  181. data/spec/ramaze/template.rb +48 -1
  182. data/spec/ramaze/template/haml.rb +6 -16
  183. data/spec/ramaze/template/haml/locals.haml +2 -1
  184. data/spec/ramaze/template/tagz.rb +62 -0
  185. data/spec/ramaze/template/tagz/external.tagz +8 -0
  186. data/spec/ramaze/template/tagz/sum.tagz +1 -0
  187. data/spec/ramaze/template/tenjin.rb +49 -0
  188. data/spec/ramaze/template/tenjin/external.tenjin +1 -0
  189. data/spec/snippets/string/unindent.rb +15 -0
  190. metadata +509 -475
  191. data/doc/README.html +0 -729
  192. data/doc/changes.txt +0 -5757
  193. data/doc/changes.xml +0 -5759
  194. data/examples/blog/src/view.rb +0 -16
  195. data/examples/blog/template/edit.xhtml +0 -19
  196. data/examples/blog/template/index.xhtml +0 -19
  197. data/examples/blog/template/new.xhtml +0 -18
  198. data/examples/wiktacular/mkd/newpagename/current.mkd +0 -1
  199. data/examples/wiktacular/mkd/newpagename/current.mkd.bak +0 -1
  200. data/lib/ramaze/contrib/email.rb-darcs-backup0 +0 -81
  201. data/lib/ramaze/template/bijou.rb +0 -39
  202. data/lib/ramaze/trinity/response.rb +0 -32
  203. data/spec/ramaze/template/bijou.rb +0 -25
  204. data/spec/ramaze/trinity/session.rb +0 -29
@@ -15,8 +15,11 @@ module Ramaze
15
15
  end
16
16
 
17
17
  require 'ramaze/action/render'
18
+ require 'ramaze/helper/link'
18
19
 
19
20
  class Action
21
+ include Helper::Link
22
+
20
23
  class << self
21
24
 
22
25
  # Instantiate with given Hash, takes both string/symbol keys.
@@ -30,10 +33,14 @@ module Ramaze
30
33
  i
31
34
  end
32
35
 
33
- # Thread.current[:action] returns the instance of Action you are currently in.
36
+ # alias for stack.last, returns the instance of Action you are currently in.
34
37
 
35
38
  def current
36
- Thread.current[:action]
39
+ stack.last
40
+ end
41
+
42
+ def stack
43
+ Thread.current[:action_stack] ||= []
37
44
  end
38
45
  end
39
46
 
@@ -4,6 +4,16 @@
4
4
  module Ramaze
5
5
  class Action
6
6
 
7
+ def stack
8
+ Action.stack << self
9
+ yield self
10
+ rescue Object => ex
11
+ Log.error "#{ex} in: #{self}"
12
+ raise ex
13
+ ensure
14
+ Action.stack.pop
15
+ end
16
+
7
17
  # Render this instance of Action, this will (eventually) pass itself to
8
18
  # Action#engine.transform
9
19
  # Usage, given that Foo is a Controller and has the method/template
@@ -12,13 +22,14 @@ module Ramaze
12
22
  # #> 'bar'
13
23
 
14
24
  def render
15
- Inform.dev("The Action: #{self}")
16
- Thread.current[:action] = self
25
+ Log.dev("Action: #{self}")
17
26
 
18
- if should_cache?
19
- cached_render
20
- else
21
- uncached_render
27
+ stack do
28
+ if should_cache?
29
+ cached_render
30
+ else
31
+ uncached_render
32
+ end
22
33
  end
23
34
  end
24
35
 
@@ -62,10 +73,10 @@ module Ramaze
62
73
  end
63
74
 
64
75
  if cache.size > 0 and (cache_opts[:ttl].nil? or cache[:time] + cache_opts[:ttl] > Time.now)
65
- Inform.debug("Using Cached version")
76
+ Log.debug("Using Cached version")
66
77
  Response.current['Content-Type'] = cache[:type]
67
78
  else
68
- Inform.debug("Compiling Action")
79
+ Log.debug("Compiling Action")
69
80
  cache.replace({ :time => Time.now, :content => uncached_render, :type => Response.current['Content-Type'] })
70
81
  end
71
82
 
@@ -77,9 +88,9 @@ module Ramaze
77
88
  # Layout will be found and rendered in this step after self was rendered.
78
89
 
79
90
  def uncached_render
80
- content = [before_process,
81
- engine.transform(self),
82
- after_process].join
91
+ before_process
92
+
93
+ content = engine.transform(self)
83
94
 
84
95
  if path and tlayout = layout
85
96
  [instance, tlayout.instance].each do |i|
@@ -87,34 +98,39 @@ module Ramaze
87
98
  end
88
99
 
89
100
  content = tlayout.render
90
-
91
- # restore Action.current after render above
92
- Thread.current[:action] = self
93
101
  end
94
102
 
95
103
  content
104
+
105
+ ensure
106
+ after_process unless $!
96
107
  end
97
108
 
98
109
  # Determine whether or not we have a layout to process and sets it up
99
- # correctly to be rendered in the same context as current action.
100
- # Will return false if the layout is the same as current action to avoid
101
- # infinite recursion and also if no layout on this controller was found.
110
+ # correctly to be rendered in the same context as current action. Will
111
+ # return false if the layout is the same as current action to avoid
112
+ # infinite recursion and also if no layout on this controller or its
113
+ # ancestors was found.
102
114
 
103
115
  def layout
104
- return false unless layouts = controller.trait[:layout]
116
+ return false unless layouts = controller.ancestral_trait[:layout]
105
117
 
106
- possible = [layouts[:all], layouts[path]].compact
118
+ possible = [layouts[path], layouts[:all]].compact
107
119
  denied = layouts[:deny].to_a
108
120
 
109
121
  if layout = possible.first
110
- layout_action = Ramaze::Controller.resolve(layout)
111
-
112
- if denied.include?(path) or layout_action.path == path
113
- return false
122
+ if layout.to_s !~ /\A\// # late bind layout action to current controller
123
+ layout = R(controller, layout)
114
124
  end
125
+ layout_action = Controller.resolve(layout)
126
+
127
+ return false if denied.any?{|deny| deny === path} or layout_action.path == path
115
128
 
116
- unless layout_action.controller == controller
129
+ if layout_action.controller != controller
117
130
  instance.instance_variables.each do |x|
131
+ if layout_action.instance.instance_variable_defined?(x)
132
+ Log.warn "overwriting instance variable #{x} from layout controller with instance variable from action controller."
133
+ end
118
134
  layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))
119
135
  end
120
136
  else
@@ -1,13 +1,6 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- require 'socket'
5
- require 'timeout'
6
- require 'benchmark'
7
-
8
- require 'rack'
9
- require 'rack/utils'
10
-
11
4
  require 'ramaze/trinity'
12
5
  require 'ramaze/tool/record'
13
6
  require 'ramaze/adapter/base'
@@ -47,7 +40,7 @@ module Ramaze
47
40
  rescue SystemExit
48
41
  Ramaze.shutdown
49
42
  rescue Object => ex
50
- Inform.error(ex)
43
+ Log.error(ex)
51
44
  Ramaze.shutdown
52
45
  end
53
46
 
@@ -61,17 +54,19 @@ module Ramaze
61
54
  if adapter = Global.adapter
62
55
  host, ports = Global.host, Global.ports
63
56
 
64
- Inform.info("Adapter: #{adapter}, testing connection to #{host}:#{ports}")
65
- test_connections(host, ports)
57
+ if Global.test_connections
58
+ Log.info("Adapter: #{adapter}, testing connection to #{host}:#{ports}")
59
+ test_connections(host, ports)
60
+ Log.info("and we're running: #{host}:#{ports}")
61
+ end
66
62
 
67
- Inform.info("and we're running: #{host}:#{ports}")
68
63
  adapter.start(host, ports)
69
64
  else # run dummy
70
65
  Global.adapters.add Thread.new{ sleep }
71
- Inform.warn("Seems like Global.adapter is turned off", "Continue without adapter.")
66
+ Log.warn("Seems like Global.adapter is turned off", "Continue without adapter.")
72
67
  end
73
68
  rescue LoadError => ex
74
- Inform.warn(ex, "Continue without adapter.")
69
+ Log.warn(ex, "Continue without adapter.")
75
70
  end
76
71
 
77
72
  # Calls ::shutdown on all running adapters and waits up to 1 second for
@@ -94,11 +89,9 @@ module Ramaze
94
89
  # Shuts down if no connection is possible.
95
90
 
96
91
  def test_connections host, ports
97
- return unless Global.test_connections
98
-
99
92
  ports.each do |port|
100
93
  unless test_connection(host, port)
101
- Inform.error("Cannot open connection on #{host}:#{port}")
94
+ Log.error("Cannot open connection on #{host}:#{port}")
102
95
  Ramaze.shutdown
103
96
  end
104
97
  end
@@ -114,7 +107,7 @@ module Ramaze
114
107
  true
115
108
  end
116
109
  rescue => ex
117
- Inform.error(ex)
110
+ Log.error(ex)
118
111
  false
119
112
  end
120
113
  end
@@ -24,7 +24,7 @@ module Ramaze
24
24
  # Does nothing
25
25
 
26
26
  def stop
27
- Inform.debug("Stopping #{self.class}")
27
+ Log.debug("Stopping #{self.class}")
28
28
  end
29
29
 
30
30
  # This is called by Rack with the usual env, subsequently calls
@@ -34,14 +34,14 @@ module Ramaze
34
34
  # calls .finish on the current response after ::respond has finished.
35
35
 
36
36
  def call(env)
37
- if Ramaze::Global.benchmarking
38
- time = Benchmark.measure{ respond(env) }
39
- Inform.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])
37
+ returned = nil
38
+ if Global.benchmarking
39
+ time = Benchmark.measure{ returned = respond(env) }
40
+ Log.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])
40
41
  else
41
- respond env
42
+ returned = respond env
42
43
  end
43
-
44
- Thread.current[:response].finish
44
+ returned
45
45
  end
46
46
 
47
47
  # Initializes Request with env and an empty Response. Records the
@@ -49,11 +49,7 @@ module Ramaze
49
49
  # Then goes on and calls Dispatcher::handle with request and response.
50
50
 
51
51
  def respond env
52
- request, response = Request.new(env), Response.new
53
- if filter = Global.record
54
- Record << request if filter[request]
55
- end
56
- Dispatcher.handle(request, response)
52
+ Current.call env
57
53
  end
58
54
  end
59
55
  end
@@ -1,21 +1,22 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- require 'ramaze/adapter'
4
+ module Ramaze
5
+ Global.test_connections = false
5
6
 
6
- module Ramaze::Adapter
7
+ module Adapter
8
+ # Our CGI adapter acts as wrapper for the Rack::Handler::CGI.
9
+ class Cgi < Base
10
+ class << self
7
11
 
8
- # Our CGI adapter acts as wrapper for the Rack::Handler::CGI.
9
- class Cgi < Base
10
- class << self
11
-
12
- # start CGI in a new thread, host and port parameter are only taken
13
- # to make it compatible with other adapters but have no influence and
14
- # can be omitted
15
- def start host = nil, ports = nil
16
- Thread.new do
17
- Thread.current[:task] = :cgi
18
- Rack::Handler::CGI.run(self)
12
+ # start CGI in a new thread, host and port parameter are only taken
13
+ # to make it compatible with other adapters but have no influence and
14
+ # can be omitted
15
+ def start host = nil, ports = nil
16
+ Thread.new do
17
+ Thread.current[:task] = :cgi
18
+ Rack::Handler::CGI.run(self)
19
+ end
19
20
  end
20
21
  end
21
22
  end
@@ -0,0 +1,34 @@
1
+ require 'ebb'
2
+
3
+ module Ramaze
4
+ Global.test_connections = true
5
+
6
+ module Adapter
7
+ class Ebb < Base
8
+ class << self
9
+
10
+ # start server on given host and port.
11
+ def run_server host, port
12
+ server = ::Ebb::Server.new(self, :port => port)
13
+
14
+ thread = Thread.new{ server.start }
15
+ thread[:adapter] = server
16
+ thread
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ class Response
23
+ def finish(&block)
24
+ @block = block
25
+
26
+ if [201, 204, 304].include?(status.to_i)
27
+ header.delete "Content-Type"
28
+ [status.to_i, header.to_hash, '']
29
+ else
30
+ [status.to_i, header.to_hash, [body].flatten.join]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- Ramaze::Inform.debug "Using Evented Mongrel"
4
+ Ramaze::Log.debug "Using Evented Mongrel"
5
5
 
6
6
  require 'swiftcore/evented_mongrel'
7
7
  require 'ramaze/adapter/mongrel'
@@ -1,24 +1,24 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- require 'ramaze/adapter'
4
+ module Ramaze
5
+ Global.test_connections = false
5
6
 
6
- module Ramaze::Adapter
7
+ module Adapter
8
+ # Our Fcgi adapter acts as wrapper for the Rack::Handler::FastCGI.
9
+ class Fcgi < Base
10
+ class << self
7
11
 
8
- # Our Fcgi adapter acts as wrapper for the Rack::Handler::FastCGI.
9
- class Fcgi < Base
10
- class << self
11
-
12
- # start FastCGI in a new thread, host and port parameter are only taken
13
- # to make it compatible with other adapters but have no influence and
14
- # can be omitted
15
- def run_server host = nil, ports = nil
16
- Thread.new do
17
- Thread.current[:task] = :cgi
18
- Rack::Handler::FastCGI.run(self)
12
+ # start FastCGI in a new thread, host and port parameter are only taken
13
+ # to make it compatible with other adapters but have no influence and
14
+ # can be omitted
15
+ def run_server host = nil, ports = nil
16
+ Thread.new do
17
+ Thread.current[:task] = :cgi
18
+ Rack::Handler::FastCGI.run(self)
19
+ end
19
20
  end
20
21
  end
21
22
  end
22
23
  end
23
24
  end
24
-
@@ -1,17 +1,21 @@
1
- require 'ramaze/adapter'
1
+ # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
2
3
 
3
- module Ramaze::Adapter
4
+ module Ramaze
5
+ Global.test_connections = false
4
6
 
5
- # Our Lsws adapter acts as wrapper for the Rack::Handler::LSWS.
6
- class Lsws < Base
7
- class << self
7
+ module Adapter
8
+ # Our Lsws adapter acts as wrapper for the Rack::Handler::LSWS.
9
+ class Lsws < Base
10
+ class << self
8
11
 
9
- # start Lsws in a new thread, host and port parameter are only taken
10
- # to make it compatible with other adapters but have no influence and
11
- # can be omitted
12
- def run_server host = nil, ports = nil
13
- Thread.new do
14
- Rack::Handler::LSWS.run(self)
12
+ # start Lsws in a new thread, host and port parameter are only taken
13
+ # to make it compatible with other adapters but have no influence and
14
+ # can be omitted
15
+ def run_server host = nil, ports = nil
16
+ Thread.new do
17
+ Rack::Handler::LSWS.run(self)
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -2,10 +2,11 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  require 'mongrel'
5
- require 'ramaze/adapter'
6
5
  require 'rack/handler/mongrel'
7
6
 
8
7
  module Ramaze
8
+ Global.test_connections = true
9
+
9
10
  module Adapter
10
11
 
11
12
  # Our Mongrel adapter acts as wrapper for the Rack::Handler::Mongrel.
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2008 Jeremy Evans code@jeremyevans.net
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'rack/handler/scgi'
5
+
6
+ module Ramaze
7
+ Global.test_connections = true
8
+
9
+ module Adapter
10
+ # Our Scgi adapter acts as wrapper for the Rack::Handler::SCGI.
11
+ class Scgi < Base
12
+ class << self
13
+
14
+ # start SCGI in a new thread
15
+ def run_server host, port
16
+ Thread.new do
17
+ Thread.current[:task] = :cgi
18
+ Rack::Handler::SCGI.run(self, :Host=>host, :Port=>port)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end