mongrel2 0.21.0 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +55 -1
- data/History.rdoc +12 -0
- data/Manifest.txt +0 -4
- data/Rakefile +2 -1
- data/bin/m2sh.rb +22 -9
- data/examples/helloworld-handler.rb +3 -3
- data/examples/request-dumper.rb +3 -3
- data/examples/ws-echo.rb +3 -3
- data/lib/mongrel2.rb +9 -6
- data/lib/mongrel2/config.rb +14 -10
- data/lib/mongrel2/config/dsl.rb +7 -2
- data/lib/mongrel2/config/host.rb +3 -3
- data/lib/mongrel2/config/server.rb +6 -6
- data/lib/mongrel2/connection.rb +5 -2
- data/lib/mongrel2/control.rb +6 -2
- data/lib/mongrel2/handler.rb +11 -6
- data/lib/mongrel2/httprequest.rb +8 -3
- data/lib/mongrel2/httpresponse.rb +6 -3
- data/lib/mongrel2/jsonrequest.rb +6 -2
- data/lib/mongrel2/request.rb +10 -8
- data/lib/mongrel2/response.rb +6 -3
- data/lib/mongrel2/table.rb +8 -5
- data/lib/mongrel2/testing.rb +10 -1
- data/lib/mongrel2/websocket.rb +1 -2
- data/lib/mongrel2/xmlrequest.rb +6 -2
- data/spec/lib/helpers.rb +11 -43
- data/spec/mongrel2/handler_spec.rb +0 -5
- data/spec/mongrel2_spec.rb +1 -1
- metadata +23 -11
- metadata.gz.sig +0 -0
- data/lib/mongrel2/logging.rb +0 -241
- data/lib/mongrel2/mixins.rb +0 -143
- data/spec/mongrel2/logging_spec.rb +0 -76
- data/spec/mongrel2/mixins_spec.rb +0 -62
@@ -1,76 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
BEGIN {
|
4
|
-
require 'pathname'
|
5
|
-
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
6
|
-
|
7
|
-
libdir = basedir + "lib"
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
10
|
-
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
11
|
-
}
|
12
|
-
|
13
|
-
require 'rspec'
|
14
|
-
require 'stringio'
|
15
|
-
|
16
|
-
require 'spec/lib/helpers'
|
17
|
-
|
18
|
-
require 'mongrel2'
|
19
|
-
require 'mongrel2/logging'
|
20
|
-
|
21
|
-
|
22
|
-
#####################################################################
|
23
|
-
### C O N T E X T S
|
24
|
-
#####################################################################
|
25
|
-
|
26
|
-
describe Mongrel2::Logging, "-extended module" do
|
27
|
-
|
28
|
-
before( :each ) do
|
29
|
-
@extended_module = Module.new do
|
30
|
-
extend Mongrel2::Logging
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should have a default Logger" do
|
35
|
-
@extended_module.logger.should be_a( Logger )
|
36
|
-
@extended_module.default_logger.should equal( @extended_module.logger )
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should know if its default logger is replaced" do
|
40
|
-
@extended_module.should be_using_default_logger
|
41
|
-
@extended_module.logger = Logger.new( $stderr )
|
42
|
-
@extended_module.should_not be_using_default_logger
|
43
|
-
end
|
44
|
-
|
45
|
-
it "has the default logger instance after being reset" do
|
46
|
-
@extended_module.reset_logger
|
47
|
-
@extended_module.logger.should equal( @extended_module.default_logger )
|
48
|
-
end
|
49
|
-
|
50
|
-
it "has the default log formatter instance after being reset" do
|
51
|
-
@extended_module.reset_logger
|
52
|
-
@extended_module.logger.formatter.should equal( @extended_module.default_log_formatter )
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
context "with new defaults" do
|
57
|
-
|
58
|
-
before( :each ) do
|
59
|
-
@sink = StringIO.new
|
60
|
-
@logger = Logger.new( @sink )
|
61
|
-
@formatter = Mongrel2::Logging::ColorFormatter.new( @logger )
|
62
|
-
|
63
|
-
@extended_module.default_logger = @logger
|
64
|
-
@extended_module.default_log_formatter = @formatter
|
65
|
-
end
|
66
|
-
|
67
|
-
it "uses the new defaults when the logging subsystem is reset" do
|
68
|
-
@extended_module.reset_logger
|
69
|
-
@extended_module.logger.should equal( @logger )
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
|
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
BEGIN {
|
4
|
-
require 'pathname'
|
5
|
-
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
6
|
-
|
7
|
-
libdir = basedir + "lib"
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
10
|
-
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
11
|
-
}
|
12
|
-
|
13
|
-
require 'rspec'
|
14
|
-
|
15
|
-
require 'spec/lib/helpers'
|
16
|
-
|
17
|
-
require 'mongrel2'
|
18
|
-
require 'mongrel2/mixins'
|
19
|
-
|
20
|
-
|
21
|
-
#####################################################################
|
22
|
-
### C O N T E X T S
|
23
|
-
#####################################################################
|
24
|
-
|
25
|
-
describe Mongrel2, "mixins" do
|
26
|
-
|
27
|
-
describe Mongrel2::Loggable do
|
28
|
-
|
29
|
-
before(:each) do
|
30
|
-
@logfile = StringIO.new('')
|
31
|
-
Mongrel2.logger = Logger.new( @logfile )
|
32
|
-
|
33
|
-
@test_class = Class.new do
|
34
|
-
include Mongrel2::Loggable
|
35
|
-
|
36
|
-
def log_test_message( level, msg )
|
37
|
-
self.log.send( level, msg )
|
38
|
-
end
|
39
|
-
|
40
|
-
def logdebug_test_message( msg )
|
41
|
-
self.log_debug.debug( msg )
|
42
|
-
end
|
43
|
-
end
|
44
|
-
@obj = @test_class.new
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
it "is able to output to the log via its #log method" do
|
49
|
-
@obj.log_test_message( :debug, "debugging message" )
|
50
|
-
@logfile.rewind
|
51
|
-
@logfile.read.should =~ /debugging message/
|
52
|
-
end
|
53
|
-
|
54
|
-
it "is able to output to the log via its #log_debug method" do
|
55
|
-
@obj.logdebug_test_message( "sexydrownwatch" )
|
56
|
-
@logfile.rewind
|
57
|
-
@logfile.read.should =~ /sexydrownwatch/
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|