mongrel2 0.45.1 → 0.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +8 -0
- data/lib/mongrel2.rb +2 -2
- data/lib/mongrel2/config.rb +5 -1
- data/lib/mongrel2/constants.rb +0 -2
- data/lib/mongrel2/httprequest.rb +4 -2
- data/lib/mongrel2/request.rb +0 -1
- data/lib/mongrel2/testing.rb +40 -0
- data/spec/helpers.rb +2 -16
- data/spec/mongrel2/config/directory_spec.rb +1 -5
- data/spec/mongrel2/config/dsl_spec.rb +1 -9
- data/spec/mongrel2/config/handler_spec.rb +1 -5
- data/spec/mongrel2/config/log_spec.rb +1 -6
- data/spec/mongrel2/config/route_spec.rb +1 -5
- data/spec/mongrel2/config/server_spec.rb +1 -5
- data/spec/mongrel2/handler_spec.rb +1 -6
- data/spec/mongrel2/request_spec.rb +1 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49700ba2e7f76c60b009989939796b167fa306a4
|
4
|
+
data.tar.gz: 831cea720fb5b58e5e451a297b5754422c5acd40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc2b3e24804bc1560fa49e85ac2ef464aeccd0c7fc3075e81bb290da92a5459402bc9754fa5bb5bfb8769da5054fa98f29ccc91af9c83fde1b43eaa63a17be8d
|
7
|
+
data.tar.gz: 3491dfd9764efb5256ec50631452661d8058ecfe7e340201d88b73fdfb48a84fc28e1e7e301fea7b629d7c94f0d86c9422ccc072d6e898d62d0c8e7135bfdaa5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/lib/mongrel2.rb
CHANGED
@@ -25,10 +25,10 @@ module Mongrel2
|
|
25
25
|
abort "\n\n>>> Mongrel2 requires Ruby 2.2 or later. <<<\n\n" if RUBY_VERSION < '2.2.0'
|
26
26
|
|
27
27
|
# Library version constant
|
28
|
-
VERSION = '0.
|
28
|
+
VERSION = '0.46.0'
|
29
29
|
|
30
30
|
# Version-control revision constant
|
31
|
-
REVISION = %q$Revision:
|
31
|
+
REVISION = %q$Revision: a28294965462 $
|
32
32
|
|
33
33
|
|
34
34
|
require 'mongrel2/constants'
|
data/lib/mongrel2/config.rb
CHANGED
@@ -164,7 +164,11 @@ module Mongrel2
|
|
164
164
|
|
165
165
|
### Return a Hash of current mimetypes from the config database keyed by extension.
|
166
166
|
def self::mimetypes
|
167
|
-
|
167
|
+
unless @mimetypes
|
168
|
+
@mimetypes = Mongrel2::Config::Mimetype.to_hash( :extension, :mimetype )
|
169
|
+
@mimetypes.freeze
|
170
|
+
end
|
171
|
+
return @mimetypes
|
168
172
|
end
|
169
173
|
|
170
174
|
|
data/lib/mongrel2/constants.rb
CHANGED
@@ -29,7 +29,6 @@ module Mongrel2::Constants
|
|
29
29
|
# Maximum number of identifiers that can be included in a broadcast response
|
30
30
|
MAX_BROADCAST_IDENTS = 100
|
31
31
|
|
32
|
-
|
33
32
|
# HTTP status and result constants
|
34
33
|
module HTTP
|
35
34
|
CONTINUE = 100
|
@@ -172,6 +171,5 @@ module Mongrel2::Constants
|
|
172
171
|
|
173
172
|
end
|
174
173
|
|
175
|
-
|
176
174
|
end # module Mongrel2::Constants
|
177
175
|
|
data/lib/mongrel2/httprequest.rb
CHANGED
@@ -11,12 +11,14 @@ require 'mongrel2/httpresponse'
|
|
11
11
|
class Mongrel2::HTTPRequest < Mongrel2::Request
|
12
12
|
extend Loggability
|
13
13
|
|
14
|
-
# Loggability API -- set up logging under the 'mongrel2' log host
|
15
|
-
log_to :mongrel2
|
16
14
|
|
17
15
|
# HTTP verbs from RFC2616
|
18
16
|
HANDLED_HTTP_METHODS = [ :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE, :TRACE, :CONNECT ]
|
19
17
|
|
18
|
+
|
19
|
+
# Loggability API -- set up logging under the 'mongrel2' log host
|
20
|
+
log_to :mongrel2
|
21
|
+
|
20
22
|
# Mongrel2::Request API -- register this class as handling the HTTP verbs
|
21
23
|
register_request_type( self, *HANDLED_HTTP_METHODS )
|
22
24
|
|
data/lib/mongrel2/request.rb
CHANGED
@@ -52,7 +52,6 @@ class Mongrel2::Request
|
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
|
-
|
56
55
|
### Register the specified +subclass+ as the class to instantiate when the +METHOD+
|
57
56
|
### header is one of the specified +req_methods+. This method exists for frameworks
|
58
57
|
### which wish to provide their own Request types.
|
data/lib/mongrel2/testing.rb
CHANGED
@@ -15,6 +15,46 @@ module Mongrel2
|
|
15
15
|
# A collection of helper functions that are generally useful
|
16
16
|
# for testing Mongrel2::Handlers.
|
17
17
|
module SpecHelpers
|
18
|
+
|
19
|
+
### Inclusion callback -- install some hooks
|
20
|
+
def self::included( context )
|
21
|
+
|
22
|
+
context.before( :all ) do
|
23
|
+
setup_config_db
|
24
|
+
end
|
25
|
+
|
26
|
+
context.around( :each ) do |example|
|
27
|
+
if (( setting = example.metadata[:db] ))
|
28
|
+
if setting == :no_transaction || setting == :without_transaction
|
29
|
+
Loggability[ Mongrel2 ].debug " running without a transaction"
|
30
|
+
example.run
|
31
|
+
else
|
32
|
+
Loggability[ Mongrel2 ].debug " running with a transaction"
|
33
|
+
Mongrel2::Config.db.transaction( rollback: :always ) do
|
34
|
+
example.run
|
35
|
+
end
|
36
|
+
end
|
37
|
+
else
|
38
|
+
example.run
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
super
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
### Set up a Mongrel2 configuration database in memory.
|
47
|
+
def setup_config_db
|
48
|
+
Mongrel2::Config.db ||= Mongrel2::Config.in_memory_db
|
49
|
+
Mongrel2::Config.init_database!
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
### Truncate all the tables in the current config DB.
|
54
|
+
def clean_config_db
|
55
|
+
Mongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )
|
56
|
+
end
|
57
|
+
|
18
58
|
end # module SpecHelpers
|
19
59
|
|
20
60
|
|
data/spec/helpers.rb
CHANGED
@@ -42,20 +42,6 @@ module Mongrel2::SpecHelpers
|
|
42
42
|
end
|
43
43
|
|
44
44
|
|
45
|
-
### Set up a Mongrel2 configuration database in memory.
|
46
|
-
def setup_config_db
|
47
|
-
Mongrel2::Config.db ||= Mongrel2::Config.in_memory_db
|
48
|
-
Mongrel2::Config.init_database
|
49
|
-
clean_config_db()
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
### Wipe out any existing db data.
|
54
|
-
def clean_config_db
|
55
|
-
Mongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
45
|
### Normalize and fill in missing members for the given +opts+.
|
60
46
|
def normalize_headers( opts, defaults=TEST_HEADERS )
|
61
47
|
headers = defaults.merge( opts[:headers] || {} )
|
@@ -171,6 +157,7 @@ module Mongrel2::SpecHelpers
|
|
171
157
|
return data.encode( 'binary' )
|
172
158
|
end
|
173
159
|
|
160
|
+
|
174
161
|
### Make a Mongrel2 handshake request for a WebSocket route.
|
175
162
|
def make_websocket_handshake( opts={} )
|
176
163
|
opts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )
|
@@ -192,6 +179,7 @@ module Mongrel2::SpecHelpers
|
|
192
179
|
return data.encode( 'binary' )
|
193
180
|
end
|
194
181
|
|
182
|
+
|
195
183
|
### Make a Mongrel2 frame for a WebSocket route.
|
196
184
|
def make_websocket_frame( opts={} )
|
197
185
|
opts = TEST_WEBSOCKET_REQUEST_OPTS.merge( opts )
|
@@ -216,8 +204,6 @@ module Mongrel2::SpecHelpers
|
|
216
204
|
end
|
217
205
|
|
218
206
|
|
219
|
-
abort "You need a version of RSpec >= 2.6.0" unless defined?( RSpec )
|
220
|
-
|
221
207
|
if defined?( ::Amalgalite )
|
222
208
|
$stderr.puts ">>> Using Amalgalite #{Amalgalite::VERSION} for DB access."
|
223
209
|
else
|
@@ -11,11 +11,7 @@ require 'mongrel2/config'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Config::Directory do
|
15
|
-
|
16
|
-
before( :all ) do
|
17
|
-
setup_config_db()
|
18
|
-
end
|
14
|
+
describe Mongrel2::Config::Directory, :db do
|
19
15
|
|
20
16
|
before( :each ) do
|
21
17
|
@dir = Mongrel2::Config::Directory.new(
|
@@ -11,18 +11,10 @@ require 'mongrel2/config'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Config::DSL do
|
14
|
+
describe Mongrel2::Config::DSL, :db do
|
15
15
|
|
16
16
|
include described_class
|
17
17
|
|
18
|
-
before( :all ) do
|
19
|
-
setup_config_db()
|
20
|
-
end
|
21
|
-
|
22
|
-
before( :each ) do
|
23
|
-
clean_config_db()
|
24
|
-
end
|
25
|
-
|
26
18
|
|
27
19
|
describe 'servers' do
|
28
20
|
it "can generate a default server config using the 'server' declarative" do
|
@@ -11,11 +11,7 @@ require 'mongrel2/config'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Config::Handler do
|
15
|
-
|
16
|
-
before( :all ) do
|
17
|
-
setup_config_db()
|
18
|
-
end
|
14
|
+
describe Mongrel2::Config::Handler, :db do
|
19
15
|
|
20
16
|
before( :each ) do
|
21
17
|
Mongrel2::Config::Handler.truncate
|
@@ -13,12 +13,7 @@ require 'mongrel2/config'
|
|
13
13
|
### C O N T E X T S
|
14
14
|
#####################################################################
|
15
15
|
|
16
|
-
describe Mongrel2::Config::Log do
|
17
|
-
|
18
|
-
before( :all ) do
|
19
|
-
setup_config_db()
|
20
|
-
end
|
21
|
-
|
16
|
+
describe Mongrel2::Config::Log, :db do
|
22
17
|
|
23
18
|
it "has a convenience method for writing to the commit log" do
|
24
19
|
what = 'load etc/mongrel2.conf'
|
@@ -11,11 +11,7 @@ require 'mongrel2/config'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Config::Route do
|
15
|
-
|
16
|
-
before( :all ) do
|
17
|
-
setup_config_db()
|
18
|
-
end
|
14
|
+
describe Mongrel2::Config::Route, :db do
|
19
15
|
|
20
16
|
before( :each ) do
|
21
17
|
@route = Mongrel2::Config::Route.new( :path => '' )
|
@@ -11,11 +11,7 @@ require 'mongrel2/config'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Config::Server do
|
15
|
-
|
16
|
-
before( :all ) do
|
17
|
-
setup_config_db()
|
18
|
-
end
|
14
|
+
describe Mongrel2::Config::Server, :db do
|
19
15
|
|
20
16
|
before( :each ) do
|
21
17
|
@server = Mongrel2::Config::Server.new(
|
@@ -11,7 +11,7 @@ require 'mongrel2/handler'
|
|
11
11
|
### C O N T E X T S
|
12
12
|
#####################################################################
|
13
13
|
|
14
|
-
describe Mongrel2::Handler do
|
14
|
+
describe Mongrel2::Handler, :db do
|
15
15
|
|
16
16
|
# Make a handler class for testing that only ever handles one request, and
|
17
17
|
# keeps track of any requests it handles and their responses.
|
@@ -34,11 +34,6 @@ describe Mongrel2::Handler do
|
|
34
34
|
end # class OneShotHandler
|
35
35
|
|
36
36
|
|
37
|
-
before( :all ) do
|
38
|
-
setup_config_db()
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
37
|
# Ensure 0MQ never actually gets called
|
43
38
|
before( :each ) do
|
44
39
|
@ctx = double( '0mq context', close: nil )
|
@@ -16,10 +16,9 @@ require 'mongrel2/request'
|
|
16
16
|
### C O N T E X T S
|
17
17
|
#####################################################################
|
18
18
|
|
19
|
-
describe Mongrel2::Request do
|
19
|
+
describe Mongrel2::Request, :db do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_config_db()
|
23
22
|
|
24
23
|
# Set up a test server config so the request can find the server's chroot
|
25
24
|
server 'specs' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongrel2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
w8aNA5re5+Rt/Vvjxj5AcEnZnZiz5x959NaddQocX32Z1unHw44pzRNUur1GInfW
|
36
36
|
p4vpx2kUSFSAGjtCbDGTNV2AH8w9OU4xEmNz8c5lyoA=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2016-11-
|
38
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: sequel
|
metadata.gz.sig
CHANGED
Binary file
|