merb-core 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/Rakefile +61 -11
  2. data/bin/merb +5 -1
  3. data/lib/merb-core.rb +202 -25
  4. data/lib/merb-core/autoload.rb +19 -17
  5. data/lib/merb-core/bootloader.rb +84 -71
  6. data/lib/merb-core/config.rb +19 -14
  7. data/lib/merb-core/controller/abstract_controller.rb +16 -17
  8. data/lib/merb-core/controller/exceptions.rb +115 -70
  9. data/lib/merb-core/controller/merb_controller.rb +62 -38
  10. data/lib/merb-core/controller/mime.rb +1 -1
  11. data/lib/merb-core/controller/mixins/authentication.rb +87 -0
  12. data/lib/merb-core/controller/mixins/controller.rb +16 -15
  13. data/lib/merb-core/controller/mixins/render.rb +113 -19
  14. data/lib/merb-core/controller/mixins/responder.rb +8 -2
  15. data/lib/merb-core/controller/template.rb +1 -1
  16. data/lib/merb-core/core_ext.rb +1 -0
  17. data/lib/merb-core/core_ext/class.rb +113 -6
  18. data/lib/merb-core/core_ext/hash.rb +43 -39
  19. data/lib/merb-core/core_ext/kernel.rb +75 -38
  20. data/lib/merb-core/core_ext/mash.rb +4 -4
  21. data/lib/merb-core/core_ext/object.rb +18 -7
  22. data/lib/merb-core/core_ext/set.rb +9 -4
  23. data/lib/merb-core/core_ext/string.rb +29 -9
  24. data/lib/merb-core/core_ext/time.rb +13 -0
  25. data/lib/merb-core/dispatch/cookies.rb +1 -2
  26. data/lib/merb-core/dispatch/dispatcher.rb +18 -10
  27. data/lib/merb-core/dispatch/exceptions.html.erb +1 -1
  28. data/lib/merb-core/dispatch/request.rb +3 -0
  29. data/lib/merb-core/dispatch/router.rb +10 -7
  30. data/lib/merb-core/dispatch/router/behavior.rb +36 -27
  31. data/lib/merb-core/dispatch/router/route.rb +7 -2
  32. data/lib/merb-core/dispatch/session/cookie.rb +4 -4
  33. data/lib/merb-core/dispatch/session/memcached.rb +17 -5
  34. data/lib/merb-core/logger.rb +2 -2
  35. data/lib/merb-core/plugins.rb +16 -4
  36. data/lib/merb-core/rack/adapter/ebb.rb +4 -1
  37. data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -0
  38. data/lib/merb-core/rack/adapter/fcgi.rb +1 -0
  39. data/lib/merb-core/rack/adapter/mongrel.rb +1 -0
  40. data/lib/merb-core/rack/adapter/runner.rb +1 -0
  41. data/lib/merb-core/rack/adapter/thin.rb +3 -1
  42. data/lib/merb-core/rack/adapter/webrick.rb +1 -0
  43. data/lib/merb-core/rack/application.rb +17 -1
  44. data/lib/merb-core/server.rb +78 -28
  45. data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -3
  46. data/lib/merb-core/test/helpers/request_helper.rb +81 -27
  47. data/lib/merb-core/test/helpers/view_helper.rb +1 -1
  48. data/lib/merb-core/test/matchers/controller_matchers.rb +55 -5
  49. data/lib/merb-core/test/matchers/route_matchers.rb +8 -17
  50. data/lib/merb-core/test/matchers/view_matchers.rb +53 -11
  51. data/lib/merb-core/test/run_specs.rb +22 -14
  52. data/lib/merb-core/test/tasks/spectasks.rb +54 -33
  53. data/lib/merb-core/vendor/facets/inflect.rb +91 -2
  54. data/lib/merb-core/version.rb +2 -2
  55. data/spec/private/config/config_spec.rb +54 -26
  56. data/spec/private/core_ext/class_spec.rb +22 -0
  57. data/spec/private/core_ext/hash_spec.rb +70 -54
  58. data/spec/private/core_ext/kernel_spec.rb +149 -14
  59. data/spec/private/core_ext/object_spec.rb +92 -10
  60. data/spec/private/core_ext/string_spec.rb +162 -4
  61. data/spec/private/core_ext/time_spec.rb +16 -0
  62. data/spec/private/dispatch/bootloader_spec.rb +24 -0
  63. data/spec/private/dispatch/fixture/app/views/exeptions/client_error.html.erb +1 -1
  64. data/spec/private/dispatch/fixture/app/views/exeptions/internal_server_error.html.erb +1 -1
  65. data/spec/private/dispatch/fixture/app/views/exeptions/not_acceptable.html.erb +1 -1
  66. data/spec/private/dispatch/fixture/app/views/exeptions/not_found.html.erb +1 -1
  67. data/spec/private/dispatch/fixture/config/black_hole.rb +12 -0
  68. data/spec/private/dispatch/fixture/log/merb_test.log +138 -0
  69. data/spec/private/plugins/plugin_spec.rb +79 -8
  70. data/spec/private/rack/application_spec.rb +1 -1
  71. data/spec/public/abstract_controller/controllers/filters.rb +26 -0
  72. data/spec/public/abstract_controller/controllers/helpers.rb +2 -2
  73. data/spec/public/abstract_controller/controllers/partial.rb +2 -2
  74. data/spec/public/abstract_controller/controllers/render.rb +16 -4
  75. data/spec/public/abstract_controller/filter_spec.rb +8 -0
  76. data/spec/public/abstract_controller/render_spec.rb +12 -0
  77. data/spec/public/controller/authentication_spec.rb +103 -0
  78. data/spec/public/controller/base_spec.rb +4 -3
  79. data/spec/public/controller/controllers/authentication.rb +47 -0
  80. data/spec/public/controller/controllers/base.rb +1 -0
  81. data/spec/public/controller/controllers/display.rb +30 -0
  82. data/spec/public/controller/controllers/views/layout/custom_arg.html.erb +1 -0
  83. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template_argument/index.html.erb +1 -0
  84. data/spec/public/controller/display_spec.rb +17 -0
  85. data/spec/public/controller/spec_helper.rb +1 -0
  86. data/spec/public/controller/url_spec.rb +25 -7
  87. data/spec/public/core/merb_core_spec.rb +34 -0
  88. data/spec/public/directory_structure/directory/app/controllers/custom.rb +2 -2
  89. data/spec/public/directory_structure/directory/log/merb_test.log +48 -0
  90. data/spec/public/logger/logger_spec.rb +10 -4
  91. data/spec/public/reloading/directory/app/controllers/reload.rb +1 -1
  92. data/spec/public/reloading/directory/log/merb_test.log +13 -0
  93. data/spec/public/reloading/reload_spec.rb +23 -22
  94. data/spec/public/request/request_spec.rb +2 -0
  95. data/spec/public/router/nested_resources_spec.rb +7 -0
  96. data/spec/public/router/resources_spec.rb +46 -1
  97. data/spec/public/router/special_spec.rb +5 -1
  98. data/spec/public/test/controller_matchers_spec.rb +25 -1
  99. data/spec/public/test/controllers/spec_helper_controller.rb +8 -0
  100. data/spec/public/test/request_helper_spec.rb +52 -1
  101. data/spec/public/test/route_matchers_spec.rb +27 -25
  102. data/spec/public/test/view_helper_spec.rb +1 -1
  103. data/spec/public/test/view_matchers_spec.rb +148 -72
  104. metadata +23 -3
@@ -21,7 +21,8 @@ module Merb
21
21
  :session_id_key => "_session_id",
22
22
  :log_delimiter => " ~ ",
23
23
  :log_auto_flush => false,
24
- :disabled_components => []
24
+ :disabled_components => [],
25
+ :deferred_actions => []
25
26
  }
26
27
  end
27
28
 
@@ -90,7 +91,7 @@ module Merb
90
91
  # ==== Returns
91
92
  # String:: The config as YAML.
92
93
  def to_yaml
93
- @configuration.to_yaml
94
+ @configuration.to_yaml
94
95
  end
95
96
 
96
97
  # Sets up the configuration by storing the given settings.
@@ -120,7 +121,7 @@ module Merb
120
121
  opts.release = Merb::RELEASE
121
122
 
122
123
  opts.banner = "Usage: merb [uGdcIpPhmailLerkKX] [argument]"
123
- opts.define_head "Merb Mongrel+ Erb. Lightweight replacement for ActionPack."
124
+ opts.define_head "Merb. Pocket rocket web framework"
124
125
  opts.separator '*'*80
125
126
  opts.separator 'If no flags are given, Merb starts in the foreground on port 4000.'
126
127
  opts.separator '*'*80
@@ -141,7 +142,7 @@ module Merb
141
142
  options[:cluster] = nodes
142
143
  end
143
144
 
144
- opts.on("-I", "--init-file FILE", "Name of the file to load first") do |init_file|
145
+ opts.on("-I", "--init-file FILE", "File to use for initialization on load, defaults to config/init.rb") do |init_file|
145
146
  options[:init_file] = init_file
146
147
  end
147
148
 
@@ -161,14 +162,18 @@ module Merb
161
162
  options[:merb_root] = File.expand_path(root)
162
163
  end
163
164
 
164
- opts.on("-a", "--adapter mongrel", "The rack adapter to use to run merb[mongrel, emongrel, thin, fastcgi, webrick, runner, irb]") do |adapter|
165
+ opts.on("-a", "--adapter mongrel", "The rack adapter to use to run merb[mongrel, emongrel, thin, ebb, fastcgi, webrick, runner, irb]") do |adapter|
165
166
  options[:adapter] = adapter
166
167
  end
167
168
 
169
+ opts.on("-R", "--rackup FILE", "Load an alternate Rack config file (default is config/rack.rb)") do |rackup|
170
+ options[:rackup] = rackup
171
+ end
172
+
168
173
  opts.on("-i", "--irb-console", "This flag will start merb in irb console mode. All your models and other classes will be available for you in an irb session.") do |console|
169
174
  options[:adapter] = 'irb'
170
175
  end
171
-
176
+
172
177
  opts.on("-S", "--sandbox", "This flag will enable a sandboxed irb console. If your ORM supports transactions, all edits will be rolled back on exit.") do |sandbox|
173
178
  options[:sandbox] = true
174
179
  end
@@ -185,20 +190,20 @@ module Merb
185
190
  options[:environment] = env
186
191
  end
187
192
 
188
- opts.on("-r", "--script-runner ['RUBY CODE'| FULL_SCRIPT_PATH]",
193
+ opts.on("-r", "--script-runner ['RUBY CODE'| FULL_SCRIPT_PATH]",
189
194
  "Command-line option to run scripts and/or code in the merb app.") do |code_or_file|
190
195
  options[:runner_code] = code_or_file
191
196
  options[:adapter] = 'runner'
192
197
  end
193
198
 
194
199
  opts.on("-K", "--graceful PORT or all", "Gracefully kill one merb proceses by port number. Use merb -K all to gracefully kill all merbs.") do |ports|
195
- @configuration = defaults.merge(options)
196
- Merb::Server.kill(ports, 1)
200
+ options[:action] = :kill
201
+ options[:port] = ports
197
202
  end
198
203
 
199
204
  opts.on("-k", "--kill PORT or all", "Kill one merb proceses by port number. Use merb -k all to kill all merbs.") do |port|
200
- @configuration = defaults.merge(options)
201
- Merb::Server.kill(port, 9)
205
+ options[:action] = :kill_9
206
+ options[:port] = port
202
207
  end
203
208
 
204
209
  opts.on("-X", "--mutex on/off", "This flag is for turning the mutex lock on and off.") do |mutex|
@@ -206,7 +211,7 @@ module Merb
206
211
  options[:use_mutex] = false
207
212
  else
208
213
  options[:use_mutex] = true
209
- end
214
+ end
210
215
  end
211
216
 
212
217
  opts.on("-D", "--debugger", "Run merb using rDebug.") do
@@ -222,7 +227,7 @@ module Merb
222
227
  end
223
228
 
224
229
  opts.on("-?", "-H", "--help", "Show this help message") do
225
- puts opts
230
+ puts opts
226
231
  exit
227
232
  end
228
233
  end
@@ -249,7 +254,7 @@ module Merb
249
254
  def configure(&block)
250
255
  ConfigBlock.new(self, &block) if block_given?
251
256
  end
252
-
257
+
253
258
  # Allows retrieval of single key config values via Merb.config.<key>
254
259
  # Allows single key assignment via Merb.config.<key> = ...
255
260
  #
@@ -14,6 +14,7 @@
14
14
  # ==== Examples
15
15
  # before :some_filter
16
16
  # before :authenticate, :exclude => [:login, :signup]
17
+ # before :has_role, :with => ["Admin"], :exclude => [:index,:show]
17
18
  # before Proc.new {|c| c.some_method }, :only => :foo
18
19
  # before :authorize, :unless => logged_in?
19
20
  #
@@ -89,7 +90,7 @@ class Merb::AbstractController
89
90
  # structure for your app.
90
91
  #
91
92
  # ==== Parameters
92
- # action<~to_s>:: The controller action.
93
+ # context<~to_s>:: The controller context (the action or template name).
93
94
  # type<~to_s>:: The content type. Defaults to nil.
94
95
  # controller<~to_s>::
95
96
  # The name of the controller. Defaults to controller_name.
@@ -98,9 +99,9 @@ class Merb::AbstractController
98
99
  # ==== Returns
99
100
  # String::
100
101
  # Indicating where to look for the template for the current controller,
101
- # action, and content-type.
102
+ # context, and content-type.
102
103
  #
103
- # ==== Note
104
+ # ==== Notes
104
105
  # The type is irrelevant for controller-types that don't support
105
106
  # content-type negotiation, so we default to not include it in the
106
107
  # superclass.
@@ -114,8 +115,8 @@ class Merb::AbstractController
114
115
  # of controller/action.mime.type
115
116
  #---
116
117
  # @public
117
- def _template_location(action, type = nil, controller = controller_name)
118
- "#{controller}/#{action}"
118
+ def _template_location(context, type = nil, controller = controller_name)
119
+ controller ? "#{controller}/#{context}" : context
119
120
  end
120
121
 
121
122
  # ==== Returns
@@ -158,15 +159,6 @@ class Merb::AbstractController
158
159
  HERE
159
160
  super
160
161
  end
161
-
162
- # ==== Parameters
163
- # layout<~to_s>:: The layout that should be used for this class
164
- #
165
- # ==== Returns
166
- # ~to_s:: The layout that was passed in
167
- def layout(layout)
168
- self._layout = layout
169
- end
170
162
  end
171
163
 
172
164
  attr_accessor :_benchmarks, :_thrown_content
@@ -218,6 +210,7 @@ class Merb::AbstractController
218
210
  _call_filters(_after_filters)
219
211
  @_benchmarks[:after_filters_time] = Time.now - start if _after_filters
220
212
  finalize_session
213
+ @body
221
214
  end
222
215
 
223
216
  # This method exists to provide an overridable hook for ActionArgs
@@ -247,7 +240,13 @@ class Merb::AbstractController
247
240
  (filter_set || []).each do |filter, rule|
248
241
  if _call_filter_for_action?(rule, action_name) && _filter_condition_met?(rule)
249
242
  case filter
250
- when Symbol, String then send(filter)
243
+ when Symbol, String
244
+ if rule.key?(:with)
245
+ args = rule[:with]
246
+ send(filter, *args)
247
+ else
248
+ send(filter)
249
+ end
251
250
  when Proc then self.instance_eval(&filter)
252
251
  end
253
252
  end
@@ -323,7 +322,7 @@ class Merb::AbstractController
323
322
  # Filter options (see class documentation under <tt>Filter Options</tt>).
324
323
  # &block:: Currently ignored.
325
324
  #
326
- # ==== Note
325
+ # ==== Notes
327
326
  # If the filter already exists, its options will be replaced with opts.
328
327
  def self.after(filter = nil, opts = {}, &block)
329
328
  add_filter(self._after_filters, filter, opts)
@@ -335,7 +334,7 @@ class Merb::AbstractController
335
334
  # Filter options (see class documentation under <tt>Filter Options</tt>).
336
335
  # &block:: A block to use as a filter if filter is nil.
337
336
  #
338
- # ==== Note
337
+ # ==== Notes
339
338
  # If the filter already exists, its options will be replaced with opts.
340
339
  def self.before(filter = nil, opts = {}, &block)
341
340
  add_filter(self._before_filters, filter || block, opts)
@@ -58,7 +58,7 @@ module Merb
58
58
  # "team@cowboys.com",
59
59
  # "Exception occured at #{Time.now}",
60
60
  # params[:exception])
61
- # render :inline => 'Something is wrong, but the team are on it!'
61
+ # render 'Something is wrong, but the team are on it!'
62
62
  # end
63
63
  #
64
64
  # Note: The special param[:exception] is available in all Exception actions
@@ -101,135 +101,180 @@ module Merb
101
101
  # String:: The snake cased name of the error without the namespace.
102
102
  def name; self.class.name; end
103
103
 
104
- # ==== Returns
105
- # String:: The snake cased name of the class without the namespace.
106
- def self.name
107
- to_s.snake_case.split('::').last
108
- end
104
+ # === Returns
105
+ # Integer:: The status-code of the error.
106
+ def status; self.class.status; end
107
+ alias :to_i :status
108
+
109
+ class << self
110
+
111
+ # ==== Returns
112
+ # String:: The snake cased name of the class without the namespace.
113
+ def name
114
+ self.to_s.split('::').last.snake_case
115
+ end
109
116
 
110
- # Makes it possible to pass a status-code class to render :status.
111
- #
112
- # ==== Returns
113
- # Fixnum:: The status code of this exception.
114
- def self.to_i
115
- STATUS
116
- end
117
+ # Get the actual status-code for an Exception class.
118
+ #
119
+ # As usual, this can come from a constant upwards in
120
+ # the inheritance chain.
121
+ #
122
+ # ==== Returns
123
+ # Fixnum:: The status code of this exception.
124
+ def status
125
+ const_get(:STATUS) rescue 0
126
+ end
127
+ alias :to_i :status
128
+
129
+ # Set the actual status-code for an Exception class.
130
+ #
131
+ # If possible, set the STATUS constant, and update
132
+ # any previously registered (inherited) status-code.
133
+ #
134
+ # ==== Parameters
135
+ # num<~to_i>:: The status code
136
+ def status=(num)
137
+ unless self.status?
138
+ register_status_code(self, num)
139
+ self.const_set(:STATUS, num.to_i)
140
+ end
141
+ end
117
142
 
118
- # Registers any subclasses with status codes for easy lookup by
119
- # set_status in Merb::Controller.
120
- #
121
- # Inheritance ensures this method gets inherited by any subclasses, so
122
- # it goes all the way down the chain of inheritance.
123
- #
124
- # ==== Parameters
125
- #
126
- # subclass<Merb::ControllerExceptions::Base>::
127
- # The Exception class that is inheriting from Merb::ControllerExceptions::Base
128
- def self.inherited(subclass)
129
- if subclass.const_defined?(:STATUS)
130
- STATUS_CODES[subclass.name.snake_case.to_sym] = subclass.const_get(:STATUS)
143
+ # See if a status-code has been defined (on self explicitly).
144
+ #
145
+ # ==== Returns
146
+ # Boolean:: Whether the a status code has been set
147
+ def status?
148
+ self.const_defined?(:STATUS)
149
+ end
150
+
151
+ # Registers any subclasses with status codes for easy lookup by
152
+ # set_status in Merb::Controller.
153
+ #
154
+ # Inheritance ensures this method gets inherited by any subclasses, so
155
+ # it goes all the way down the chain of inheritance.
156
+ #
157
+ # ==== Parameters
158
+ #
159
+ # subclass<Merb::ControllerExceptions::Base>::
160
+ # The Exception class that is inheriting from Merb::ControllerExceptions::Base
161
+ def inherited(subclass)
162
+ # don't set the constant yet - any class methods will be called after self.inherited
163
+ # unless self.status = ... is set explicitly, the status code will be inherited
164
+ register_status_code(subclass, self.status) if self.status?
165
+ end
166
+
167
+ private
168
+
169
+ # Register the status-code for an Exception class.
170
+ #
171
+ # ==== Parameters
172
+ # num<~to_i>:: The status code
173
+ def register_status_code(klass, code)
174
+ STATUS_CODES[klass.name.to_sym] = code.to_i
131
175
  end
176
+
132
177
  end
133
178
  end
134
179
 
135
180
  class Informational < Merb::ControllerExceptions::Base; end
136
181
 
137
- class Continue < Merb::ControllerExceptions::Informational; STATUS = 100; end
182
+ class Continue < Merb::ControllerExceptions::Informational; self.status = 100; end
138
183
 
139
- class SwitchingProtocols < Merb::ControllerExceptions::Informational; STATUS = 101; end
184
+ class SwitchingProtocols < Merb::ControllerExceptions::Informational; self.status = 101; end
140
185
 
141
186
  class Successful < Merb::ControllerExceptions::Base; end
142
187
 
143
- class OK < Merb::ControllerExceptions::Successful; STATUS = 200; end
188
+ class OK < Merb::ControllerExceptions::Successful; self.status = 200; end
144
189
 
145
- class Created < Merb::ControllerExceptions::Successful; STATUS = 201; end
190
+ class Created < Merb::ControllerExceptions::Successful; self.status = 201; end
146
191
 
147
- class Accepted < Merb::ControllerExceptions::Successful; STATUS = 202; end
192
+ class Accepted < Merb::ControllerExceptions::Successful; self.status = 202; end
148
193
 
149
- class NonAuthoritativeInformation < Merb::ControllerExceptions::Successful; STATUS = 203; end
194
+ class NonAuthoritativeInformation < Merb::ControllerExceptions::Successful; self.status = 203; end
150
195
 
151
- class NoContent < Merb::ControllerExceptions::Successful; STATUS = 204; end
196
+ class NoContent < Merb::ControllerExceptions::Successful; self.status = 204; end
152
197
 
153
- class ResetContent < Merb::ControllerExceptions::Successful; STATUS = 205; end
198
+ class ResetContent < Merb::ControllerExceptions::Successful; self.status = 205; end
154
199
 
155
- class PartialContent < Merb::ControllerExceptions::Successful; STATUS = 206; end
200
+ class PartialContent < Merb::ControllerExceptions::Successful; self.status = 206; end
156
201
 
157
202
  class Redirection < Merb::ControllerExceptions::Base; end
158
203
 
159
- class MultipleChoices < Merb::ControllerExceptions::Redirection; STATUS = 300; end
204
+ class MultipleChoices < Merb::ControllerExceptions::Redirection; self.status = 300; end
160
205
 
161
- class MovedPermanently < Merb::ControllerExceptions::Redirection; STATUS = 301; end
206
+ class MovedPermanently < Merb::ControllerExceptions::Redirection; self.status = 301; end
162
207
 
163
- class MovedTemporarily < Merb::ControllerExceptions::Redirection; STATUS = 302; end
208
+ class MovedTemporarily < Merb::ControllerExceptions::Redirection; self.status = 302; end
164
209
 
165
- class SeeOther < Merb::ControllerExceptions::Redirection; STATUS = 303; end
210
+ class SeeOther < Merb::ControllerExceptions::Redirection; self.status = 303; end
166
211
 
167
- class NotModified < Merb::ControllerExceptions::Redirection; STATUS = 304; end
212
+ class NotModified < Merb::ControllerExceptions::Redirection; self.status = 304; end
168
213
 
169
- class UseProxy < Merb::ControllerExceptions::Redirection; STATUS = 305; end
214
+ class UseProxy < Merb::ControllerExceptions::Redirection; self.status = 305; end
170
215
 
171
- class TemporaryRedirect < Merb::ControllerExceptions::Redirection; STATUS = 307; end
216
+ class TemporaryRedirect < Merb::ControllerExceptions::Redirection; self.status = 307; end
172
217
 
173
218
  class ClientError < Merb::ControllerExceptions::Base; end
174
219
 
175
- class BadRequest < Merb::ControllerExceptions::ClientError; STATUS = 400; end
220
+ class BadRequest < Merb::ControllerExceptions::ClientError; self.status = 400; end
176
221
 
177
- class MultiPartParseError < Merb::ControllerExceptions::BadRequest; end
222
+ class MultiPartParseError < Merb::ControllerExceptions::BadRequest; end
178
223
 
179
- class Unauthorized < Merb::ControllerExceptions::ClientError; STATUS = 401; end
224
+ class Unauthorized < Merb::ControllerExceptions::ClientError; self.status = 401; end
180
225
 
181
- class PaymentRequired < Merb::ControllerExceptions::ClientError; STATUS = 402; end
226
+ class PaymentRequired < Merb::ControllerExceptions::ClientError; self.status = 402; end
182
227
 
183
- class Forbidden < Merb::ControllerExceptions::ClientError; STATUS = 403; end
228
+ class Forbidden < Merb::ControllerExceptions::ClientError; self.status = 403; end
184
229
 
185
- class NotFound < Merb::ControllerExceptions::ClientError; STATUS = 404; end
230
+ class NotFound < Merb::ControllerExceptions::ClientError; self.status = 404; end
186
231
 
187
- class ActionNotFound < Merb::ControllerExceptions::NotFound; end
232
+ class ActionNotFound < Merb::ControllerExceptions::NotFound; end
188
233
 
189
- class TemplateNotFound < Merb::ControllerExceptions::NotFound; end
234
+ class TemplateNotFound < Merb::ControllerExceptions::NotFound; end
190
235
 
191
- class LayoutNotFound < Merb::ControllerExceptions::NotFound; end
236
+ class LayoutNotFound < Merb::ControllerExceptions::NotFound; end
192
237
 
193
- class MethodNotAllowed < Merb::ControllerExceptions::ClientError; STATUS = 405; end
238
+ class MethodNotAllowed < Merb::ControllerExceptions::ClientError; self.status = 405; end
194
239
 
195
- class NotAcceptable < Merb::ControllerExceptions::ClientError; STATUS = 406; end
240
+ class NotAcceptable < Merb::ControllerExceptions::ClientError; self.status = 406; end
196
241
 
197
- class ProxyAuthenticationRequired < Merb::ControllerExceptions::ClientError; STATUS = 407; end
242
+ class ProxyAuthenticationRequired < Merb::ControllerExceptions::ClientError; self.status = 407; end
198
243
 
199
- class RequestTimeout < Merb::ControllerExceptions::ClientError; STATUS = 408; end
244
+ class RequestTimeout < Merb::ControllerExceptions::ClientError; self.status = 408; end
200
245
 
201
- class Conflict < Merb::ControllerExceptions::ClientError; STATUS = 409; end
246
+ class Conflict < Merb::ControllerExceptions::ClientError; self.status = 409; end
202
247
 
203
- class Gone < Merb::ControllerExceptions::ClientError; STATUS = 410; end
248
+ class Gone < Merb::ControllerExceptions::ClientError; self.status = 410; end
204
249
 
205
- class LengthRequired < Merb::ControllerExceptions::ClientError; STATUS = 411; end
250
+ class LengthRequired < Merb::ControllerExceptions::ClientError; self.status = 411; end
206
251
 
207
- class PreconditionFailed < Merb::ControllerExceptions::ClientError; STATUS = 412; end
252
+ class PreconditionFailed < Merb::ControllerExceptions::ClientError; self.status = 412; end
208
253
 
209
- class RequestEntityTooLarge < Merb::ControllerExceptions::ClientError; STATUS = 413; end
254
+ class RequestEntityTooLarge < Merb::ControllerExceptions::ClientError; self.status = 413; end
210
255
 
211
- class RequestURITooLarge < Merb::ControllerExceptions::ClientError; STATUS = 414; end
256
+ class RequestURITooLarge < Merb::ControllerExceptions::ClientError; self.status = 414; end
212
257
 
213
- class UnsupportedMediaType < Merb::ControllerExceptions::ClientError; STATUS = 415; end
258
+ class UnsupportedMediaType < Merb::ControllerExceptions::ClientError; self.status = 415; end
214
259
 
215
- class RequestRangeNotSatisfiable < Merb::ControllerExceptions::ClientError; STATUS = 416; end
260
+ class RequestRangeNotSatisfiable < Merb::ControllerExceptions::ClientError; self.status = 416; end
216
261
 
217
- class ExpectationFailed < Merb::ControllerExceptions::ClientError; STATUS = 417; end
262
+ class ExpectationFailed < Merb::ControllerExceptions::ClientError; self.status = 417; end
218
263
 
219
264
  class ServerError < Merb::ControllerExceptions::Base; end
220
265
 
221
- class NotImplemented < Merb::ControllerExceptions::ServerError; STATUS = 501; end
266
+ class NotImplemented < Merb::ControllerExceptions::ServerError; self.status = 501; end
222
267
 
223
- class BadGateway < Merb::ControllerExceptions::ServerError; STATUS = 502; end
268
+ class BadGateway < Merb::ControllerExceptions::ServerError; self.status = 502; end
224
269
 
225
- class ServiceUnavailable < Merb::ControllerExceptions::ServerError; STATUS = 503; end
270
+ class ServiceUnavailable < Merb::ControllerExceptions::ServerError; self.status = 503; end
226
271
 
227
- class GatewayTimeout < Merb::ControllerExceptions::ServerError; STATUS = 504; end
272
+ class GatewayTimeout < Merb::ControllerExceptions::ServerError; self.status = 504; end
228
273
 
229
- class HTTPVersionNotSupported < Merb::ControllerExceptions::ServerError; STATUS = 505; end
274
+ class HTTPVersionNotSupported < Merb::ControllerExceptions::ServerError; self.status = 505; end
230
275
 
231
276
  class InternalServerError < Merb::ControllerExceptions::ServerError #:doc:
232
- STATUS = 500
277
+ self.status = 500;
233
278
  # DEFAULT_TEMPLATE = ::Merb::Dispatcher::DEFAULT_ERROR_TEMPLATE
234
279
  def initialize(exception = nil)
235
280
  @exception = exception