merb-core 1.0.3 → 1.0.4
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.
- data/lib/merb-core.rb +5 -2
- data/lib/merb-core.rbc +8941 -0
- data/lib/merb-core/bootloader.rb +29 -7
- data/lib/merb-core/constants.rb +3 -0
- data/lib/merb-core/controller/abstract_controller.rb +2 -2
- data/lib/merb-core/controller/merb_controller.rb +2 -2
- data/lib/merb-core/controller/mixins/conditional_get.rb +4 -1
- data/lib/merb-core/controller/mixins/render.rb +1 -1
- data/lib/merb-core/controller/mixins/responder.rb +36 -7
- data/lib/merb-core/controller/template.rb +4 -3
- data/lib/merb-core/core_ext/kernel.rb +15 -10
- data/lib/merb-core/dispatch/default_exception/default_exception.rb +27 -13
- data/lib/merb-core/dispatch/default_exception/views/index.html.erb +4 -3
- data/lib/merb-core/dispatch/dispatcher.rb +3 -3
- data/lib/merb-core/dispatch/router.rb +6 -1
- data/lib/merb-core/logger.rb +9 -3
- data/lib/merb-core/rack/adapter/irb.rb +1 -0
- data/lib/merb-core/rack/adapter/thin.rb +2 -1
- data/lib/merb-core/test/matchers.rb +6 -4
- data/lib/merb-core/test/test_ext/rspec.rb +4 -1
- data/lib/merb-core/two-oh.rb +50 -0
- data/lib/merb-core/version.rb +2 -2
- metadata +4 -2
@@ -149,6 +149,7 @@ module Merb
|
|
149
149
|
def self.start(opts={})
|
150
150
|
m = Merb::Rack::Console.new
|
151
151
|
m.extend Merb::Test::RequestHelper
|
152
|
+
m.extend ::Webrat::Methods if defined?(::Webrat)
|
152
153
|
Object.send(:define_method, :merb) { m }
|
153
154
|
ARGV.clear # Avoid passing args to IRB
|
154
155
|
m.open_sandbox! if sandboxed?
|
@@ -13,7 +13,8 @@ module Merb
|
|
13
13
|
|
14
14
|
if (@opts[:socket] || @opts[:socket_file])
|
15
15
|
socket = port.to_s
|
16
|
-
socket_file = @opts[:socket_file] || "#{Merb.log_path}/#{Merb::Config[:name]}
|
16
|
+
socket_file = @opts[:socket_file] || "#{Merb.log_path}/#{Merb::Config[:name]}.%s.sock"
|
17
|
+
socket_file = socket_file % port
|
17
18
|
Merb.logger.warn!("Using Thin adapter with socket file #{socket_file}.")
|
18
19
|
@server = ::Thin::Server.new(socket_file, @opts[:app], @opts)
|
19
20
|
else
|
@@ -7,7 +7,9 @@ require "merb-core/test/matchers/request_matchers"
|
|
7
7
|
Merb::Test::ControllerHelper.send(:include, Merb::Test::Rspec::ControllerMatchers)
|
8
8
|
Merb::Test::RouteHelper.send(:include, Merb::Test::Rspec::RouteMatchers)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
if defined?(::Webrat)
|
11
|
+
module Merb::Test::ViewHelper
|
12
|
+
include ::Webrat::Matchers
|
13
|
+
include ::Webrat::HaveTagMatcher
|
14
|
+
end
|
15
|
+
end
|
@@ -43,7 +43,10 @@ module Merb
|
|
43
43
|
include ::Merb::Test::Matchers
|
44
44
|
include ::Merb::Test::RouteHelper
|
45
45
|
include ::Merb::Test::ControllerHelper
|
46
|
-
|
46
|
+
|
47
|
+
if defined?(::Webrat)
|
48
|
+
include ::Webrat::Methods
|
49
|
+
end
|
47
50
|
|
48
51
|
class << self
|
49
52
|
# This is a copy of the method in rspec, so we can have
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Merb::Test::MultipartRequestHelper
|
2
|
+
|
3
|
+
def multipart_request(path, params = {}, env = {})
|
4
|
+
multipart = Merb::Test::MultipartRequestHelper::Post.new(params)
|
5
|
+
body, head = multipart.to_multipart
|
6
|
+
env["CONTENT_TYPE"] = head
|
7
|
+
env["CONTENT_LENGTH"] = body.size
|
8
|
+
env[:input] = StringIO.new(body)
|
9
|
+
request(path, env)
|
10
|
+
end
|
11
|
+
|
12
|
+
# An HTTP POST request that operates through the router and uses multipart
|
13
|
+
# parameters.
|
14
|
+
#
|
15
|
+
# ==== Parameters
|
16
|
+
# path<String>:: The path that should go to the router as the request uri.
|
17
|
+
# params<Hash>::
|
18
|
+
# An optional hash that will end up as params in the controller instance.
|
19
|
+
# env<Hash>::
|
20
|
+
# An optional hash that is passed to the fake request. Any request options
|
21
|
+
# should go here (see +fake_request+).
|
22
|
+
# block<Proc>:: The block is executed in the context of the controller.
|
23
|
+
#
|
24
|
+
# ==== Notes
|
25
|
+
# To include an uploaded file, put a file object as a value in params.
|
26
|
+
def multipart_post(path, params = {}, env = {})
|
27
|
+
env[:method] = "POST"
|
28
|
+
multipart_request(path, params, env)
|
29
|
+
end
|
30
|
+
|
31
|
+
# An HTTP PUT request that operates through the router and uses multipart
|
32
|
+
# parameters.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
# path<String>:: The path that should go to the router as the request uri.
|
36
|
+
# params<Hash>::
|
37
|
+
# An optional hash that will end up as params in the controller instance.
|
38
|
+
# env<Hash>::
|
39
|
+
# An optional hash that is passed to the fake request. Any request options
|
40
|
+
# should go here (see +fake_request+).
|
41
|
+
# block<Proc>:: The block is executed in the context of the controller.
|
42
|
+
#
|
43
|
+
# ==== Notes
|
44
|
+
# To include an uplaoded file, put a file object as a value in params.
|
45
|
+
def multipart_put(path, params = {}, env = {}, &block)
|
46
|
+
env[:method] = "PUT"
|
47
|
+
multipart_request(path, params, env)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/lib/merb-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-08 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -231,8 +231,10 @@ files:
|
|
231
231
|
- lib/merb-core/test/test_ext/rspec.rb
|
232
232
|
- lib/merb-core/test/test_ext/string.rb
|
233
233
|
- lib/merb-core/test.rb
|
234
|
+
- lib/merb-core/two-oh.rb
|
234
235
|
- lib/merb-core/version.rb
|
235
236
|
- lib/merb-core.rb
|
237
|
+
- lib/merb-core.rbc
|
236
238
|
has_rdoc: true
|
237
239
|
homepage: http://merbivore.com
|
238
240
|
post_install_message:
|