mongrel2 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ == v0.1.1 [2011-11-14] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Update dependency to rbzmq-2.1.4 for ZMQ::Error.
4
+
5
+
1
6
  == v0.1.0 [2011-11-14] Michael Granger <ged@FaerieMUD.org>
2
7
 
3
8
  Memoize Mongrel2::Request#response, and add Mongrel2::Request.response_class to
data/Rakefile CHANGED
@@ -46,28 +46,10 @@ ENV['VERSION'] ||= hoespec.spec.version.to_s
46
46
  # Ensure the specs pass before checking in
47
47
  task 'hg:precheckin' => :spec
48
48
 
49
- ### Make the ChangeLog update if the repo has changed since it was last built
50
- file '.hg/branch'
51
- file 'ChangeLog' => '.hg/branch' do |task|
52
- $stderr.puts "Updating the changelog..."
53
- abort "Can't create the ChangeLog without hoe-mercurial (gem install hoe-mercurial)" unless
54
- defined?( MercurialHelpers )
55
-
56
- content = MercurialHelpers.make_changelog()
57
- File.open( task.name, 'w', 0644 ) do |fh|
58
- fh.print( content )
59
- end
60
- end
61
49
 
62
50
  # Rebuild the ChangeLog immediately before release
63
51
  task :prerelease => 'ChangeLog'
64
52
 
65
- if Rake::Task.task_defined?( '.gemtest' )
66
- Rake::Task['.gemtest'].clear
67
- task '.gemtest' do
68
- $stderr.puts "Not including a .gemtest until I'm confident the test suite is idempotent."
69
- end
70
- end
71
53
 
72
54
  desc "Build a coverage report"
73
55
  task :coverage do
data/examples/config.rb CHANGED
File without changes
@@ -34,12 +34,13 @@ class RequestDumper < Mongrel2::Handler
34
34
  return response
35
35
  end
36
36
 
37
- end # class HelloWorldHandler
37
+ end # class RequestDumper
38
38
 
39
- Mongrel2.log.level = Logger::INFO
39
+ Mongrel2.log.level = $DEBUG ? Logger::DEBUG : Logger::INFO
40
+ Inversion.log.level = Logger::INFO
40
41
 
41
42
  # Point to the config database, which will cause the handler to use
42
43
  # its ID to look up its own socket info.
43
- Mongrel2::Config.configure( :configdb => 'examples.sqlite' )
44
+ Mongrel2::Config.configure( :configdb => 'config.sqlite' )
44
45
  RequestDumper.run( 'request-dumper' )
45
46
 
@@ -149,9 +149,6 @@ module Mongrel2::Constants
149
149
  510 => "Not Extended"
150
150
  }
151
151
 
152
-
153
- # Methods which aren't allowed to have an entity-body
154
- SHALLOW_METHODS = [ :GET, :HEAD, :DELETE ]
155
152
  end
156
153
 
157
154
 
@@ -34,9 +34,11 @@ class Mongrel2::HTTPResponse < Mongrel2::Response
34
34
 
35
35
  super( sender_id, conn_id, body )
36
36
 
37
- @headers = Mongrel2::Table.new( headers )
37
+ @headers = Mongrel2::Table.new
38
38
  @status = nil
39
39
  self.reset
40
+
41
+ @headers.merge!( headers )
40
42
  end
41
43
 
42
44
 
@@ -138,10 +140,12 @@ class Mongrel2::HTTPResponse < Mongrel2::Response
138
140
 
139
141
  ### Return the current response header as a valid HTTP string.
140
142
  def header_data
141
- self.headers[:date] ||= Time.now.httpdate
142
- self.headers[:content_length] ||= self.get_content_length
143
+ headers = self.headers.dup
144
+
145
+ headers[:date] ||= Time.now.httpdate
146
+ headers[:content_length] ||= self.get_content_length
143
147
 
144
- return self.headers.to_s
148
+ return headers.to_s
145
149
  end
146
150
 
147
151
 
data/lib/mongrel2.rb CHANGED
@@ -14,10 +14,10 @@ module Mongrel2
14
14
  abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'
15
15
 
16
16
  # Library version constant
17
- VERSION = '0.1.1'
17
+ VERSION = '0.1.2'
18
18
 
19
19
  # Version-control revision constant
20
- REVISION = %q$Revision: 2f5183ca5446 $
20
+ REVISION = %q$Revision: 4212c8770654 $
21
21
 
22
22
 
23
23
  require 'mongrel2/logging'
@@ -30,7 +30,7 @@ describe Mongrel2::HTTPResponse do
30
30
  end
31
31
 
32
32
  before( :each ) do
33
- @response = Mongrel2::HTTPResponse.new( TEST_UUID, 299 )
33
+ @response = Mongrel2::HTTPResponse.new( TEST_UUID, 299, :content_type => 'text/html' )
34
34
  end
35
35
 
36
36
  after( :all ) do
@@ -42,15 +42,27 @@ describe Mongrel2::HTTPResponse do
42
42
  @response.headers.should be_a( Mongrel2::Table )
43
43
  end
44
44
 
45
+ it "allows headers to be set when the response is created" do
46
+ @response.headers.content_type.should == 'text/html'
47
+ end
48
+
45
49
  it "is a status 200 response if not set otherwise" do
46
50
  @response.status_line.should == 'HTTP/1.1 200 OK'
47
51
  end
48
52
 
49
53
  it "sets Date and Content-length headers automatically if they haven't been set" do
50
- @response.header_data.should =~ /Content-length: 0/i
54
+ @response << "Some stuff."
55
+
56
+ @response.header_data.should =~ /Content-length: 11/i
51
57
  @response.header_data.should =~ /Date: #{HTTP_DATE}/i
52
58
  end
53
59
 
60
+ it "re-calculates the automatically-added headers when re-rendered" do
61
+ @response.header_data.should =~ /Content-length: 0/i
62
+ @response << "More data!"
63
+ @response.header_data.should =~ /Content-length: 10/i
64
+ end
65
+
54
66
  it "doesn't have a body" do
55
67
  @response.body.should be_empty()
56
68
  end
@@ -228,5 +240,10 @@ describe Mongrel2::HTTPResponse do
228
240
  @response.should be_keepalive()
229
241
  end
230
242
 
243
+ it "has a puts method for appending objects to the body" do
244
+ @response.puts( :something_to_sable )
245
+ @response.body.should == "something_to_sable\n"
246
+ end
247
+
231
248
  end
232
249
 
data.tar.gz.sig CHANGED
Binary file
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.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -48,11 +48,11 @@ cert_chain:
48
48
  -----END CERTIFICATE-----
49
49
 
50
50
  '
51
- date: 2011-09-14 00:00:00.000000000Z
51
+ date: 2011-09-16 00:00:00.000000000Z
52
52
  dependencies:
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: nokogiri
55
- requirement: &70222682787040 !ruby/object:Gem::Requirement
55
+ requirement: &2170501340 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
58
  - - ~>
@@ -60,10 +60,10 @@ dependencies:
60
60
  version: '1.5'
61
61
  type: :runtime
62
62
  prerelease: false
63
- version_requirements: *70222682787040
63
+ version_requirements: *2170501340
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: sequel
66
- requirement: &70222682786320 !ruby/object:Gem::Requirement
66
+ requirement: &2170500720 !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
69
69
  - - ~>
@@ -71,10 +71,10 @@ dependencies:
71
71
  version: '3.26'
72
72
  type: :runtime
73
73
  prerelease: false
74
- version_requirements: *70222682786320
74
+ version_requirements: *2170500720
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: amalgalite
77
- requirement: &70222682785540 !ruby/object:Gem::Requirement
77
+ requirement: &2170500140 !ruby/object:Gem::Requirement
78
78
  none: false
79
79
  requirements:
80
80
  - - ~>
@@ -82,10 +82,10 @@ dependencies:
82
82
  version: '1.1'
83
83
  type: :runtime
84
84
  prerelease: false
85
- version_requirements: *70222682785540
85
+ version_requirements: *2170500140
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: tnetstring
88
- requirement: &70222682784540 !ruby/object:Gem::Requirement
88
+ requirement: &2170499500 !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
91
  - - ~>
@@ -93,10 +93,10 @@ dependencies:
93
93
  version: '0.3'
94
94
  type: :runtime
95
95
  prerelease: false
96
- version_requirements: *70222682784540
96
+ version_requirements: *2170499500
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yajl-ruby
99
- requirement: &70222682783760 !ruby/object:Gem::Requirement
99
+ requirement: &2170499000 !ruby/object:Gem::Requirement
100
100
  none: false
101
101
  requirements:
102
102
  - - ~>
@@ -104,10 +104,10 @@ dependencies:
104
104
  version: '0.8'
105
105
  type: :runtime
106
106
  prerelease: false
107
- version_requirements: *70222682783760
107
+ version_requirements: *2170499000
108
108
  - !ruby/object:Gem::Dependency
109
109
  name: zmq
110
- requirement: &70222682783100 !ruby/object:Gem::Requirement
110
+ requirement: &2170498380 !ruby/object:Gem::Requirement
111
111
  none: false
112
112
  requirements:
113
113
  - - ~>
@@ -115,21 +115,21 @@ dependencies:
115
115
  version: 2.1.4
116
116
  type: :runtime
117
117
  prerelease: false
118
- version_requirements: *70222682783100
118
+ version_requirements: *2170498380
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: hoe-mercurial
121
- requirement: &70222682782180 !ruby/object:Gem::Requirement
121
+ requirement: &2170497820 !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
124
124
  - - ~>
125
125
  - !ruby/object:Gem::Version
126
- version: 1.2.2
126
+ version: 1.2.1
127
127
  type: :development
128
128
  prerelease: false
129
- version_requirements: *70222682782180
129
+ version_requirements: *2170497820
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: hoe-highline
132
- requirement: &70222682781360 !ruby/object:Gem::Requirement
132
+ requirement: &2170497200 !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements:
135
135
  - - ~>
@@ -137,10 +137,10 @@ dependencies:
137
137
  version: 0.0.1
138
138
  type: :development
139
139
  prerelease: false
140
- version_requirements: *70222682781360
140
+ version_requirements: *2170497200
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: configurability
143
- requirement: &70222682757400 !ruby/object:Gem::Requirement
143
+ requirement: &2170496520 !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  requirements:
146
146
  - - ~>
@@ -148,10 +148,10 @@ dependencies:
148
148
  version: '1.0'
149
149
  type: :development
150
150
  prerelease: false
151
- version_requirements: *70222682757400
151
+ version_requirements: *2170496520
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: rspec
154
- requirement: &70222682756760 !ruby/object:Gem::Requirement
154
+ requirement: &2170495900 !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
157
157
  - - ~>
@@ -159,18 +159,18 @@ dependencies:
159
159
  version: '2.4'
160
160
  type: :development
161
161
  prerelease: false
162
- version_requirements: *70222682756760
162
+ version_requirements: *2170495900
163
163
  - !ruby/object:Gem::Dependency
164
164
  name: hoe
165
- requirement: &70222682756080 !ruby/object:Gem::Requirement
165
+ requirement: &2170495420 !ruby/object:Gem::Requirement
166
166
  none: false
167
167
  requirements:
168
168
  - - ~>
169
169
  - !ruby/object:Gem::Version
170
- version: '2.12'
170
+ version: '2.11'
171
171
  type: :development
172
172
  prerelease: false
173
- version_requirements: *70222682756080
173
+ version_requirements: *2170495420
174
174
  description: ! "A complete Ruby connector for Mongrel2[http://mongrel2.org/].\n\nThis
175
175
  library includes configuration-database ORM classes, a Ruby\nimplementation of the
176
176
  'm2sh' tool, a configuration DSL for generating config\ndatabases in pure Ruby,
metadata.gz.sig CHANGED
Binary file