reel-rack 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc7ecfe45aa2bef28b5a6b9e5e95127eb3e3a0a9
4
- data.tar.gz: 39d1a7786272eaccfc359a7f9588307d2fe2436a
3
+ metadata.gz: c61306f5108aecfb3610f71ddc1bfc032592193b
4
+ data.tar.gz: 62ffa8bc88e7128ebae5c3d4ab39b8477a0efd9e
5
5
  SHA512:
6
- metadata.gz: 61b6bcb57a21df10f709cbb614cc469c438f2d5a624ad3aeced9e473dc0325eeac0ed89e6ace1c7ebab905fc563992627ac5c8052bd688d9a97725e8d6a001e1
7
- data.tar.gz: 510c3ec44a3e4a0da0aedc5eee8c586ea801151da36d55bfe45b23098377c116af7ea600f710e9ef83a15d21aea2593d489b9d09ce55a45276c7622f7568ae36
6
+ metadata.gz: 8ee8a4a4c93aec6375caf87e314ec73890b275274f3c92a4664f15bb672dfa78278d4ed5b27204dc60676a636b6e9521c3f150a8466ebf0dd183253f11fb28dc
7
+ data.tar.gz: ba63f4cd58b68d51de6ba4ba91790945c971e445dac2f7246f5e5f0015db46f28f04f90541a8ee39274451d0bcd84c62cdd379c2b8674dd541721f13ae4aaebc
@@ -4,12 +4,13 @@ rvm:
4
4
  - ruby-head
5
5
  - jruby-19mode
6
6
  - jruby-head
7
- - rbx-19mode
7
+ - rbx-2
8
8
 
9
9
  matrix:
10
10
  allow_failures:
11
11
  - rvm: ruby-head
12
12
  - rvm: jruby-head
13
+ - rvm: rbx-2
13
14
 
14
15
  notifications:
15
16
  irc: "irc.freenode.org#celluloid"
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.2.0 (2014-04-15)
2
+ ------------------
3
+ * Updated to be API compatible with Reel 0.5.0
4
+ * Fix HTTP_CONTENT_LENGTH and HTTP_CONTENT_TYPE headers
5
+
1
6
  0.1.0 (2013-10-21)
2
7
  ------------------
3
8
  * Switch to Rack conventions for Host/Port options
@@ -5,7 +5,7 @@ require 'rack'
5
5
 
6
6
  module Reel
7
7
  module Rack
8
- class Server < Server
8
+ class Server < Reel::Server::HTTP
9
9
  include Celluloid::Logger
10
10
 
11
11
  attr_reader :app
@@ -53,11 +53,22 @@ module Reel
53
53
 
54
54
  body.close if body.respond_to? :close
55
55
  end
56
-
56
+
57
+ # Those headers must not start with 'HTTP_'.
58
+ NO_PREFIX_HEADERS=%w[CONTENT_TYPE CONTENT_LENGTH].freeze
59
+
57
60
  def convert_headers(headers)
58
- Hash[headers.map { |key, value| ['HTTP_' + key.upcase.gsub('-','_'),value ] }]
61
+ Hash[headers.map { |key, value|
62
+ header = key.upcase.gsub('-','_')
63
+
64
+ if NO_PREFIX_HEADERS.member?(header)
65
+ [header, value]
66
+ else
67
+ ['HTTP_' + header, value]
68
+ end
69
+ }]
59
70
  end
60
-
71
+
61
72
  def status_symbol(status)
62
73
  if status.is_a?(Fixnum)
63
74
  Http::Response::STATUS_CODES[status].downcase.gsub(/\s|-/, '_').to_sym
@@ -1,5 +1,5 @@
1
1
  module Reel
2
2
  module Rack
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "reel", ">= 0.4.0"
21
+ spec.add_runtime_dependency "reel", ">= 0.5.0"
22
22
  spec.add_runtime_dependency "rack", ">= 1.4.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'net/http'
3
+ require 'rack/lint'
4
+ require 'rack/head'
3
5
 
4
6
  describe Reel::Rack::Server do
5
7
  let(:host) { "127.0.0.1" }
@@ -7,8 +9,8 @@ describe Reel::Rack::Server do
7
9
  let(:body) { "hello world" }
8
10
 
9
11
  subject do
10
- app = proc { [200, {"Content-Type" => "text/plain"}, body] }
11
- described_class.new(app, :Host => host, :Port => port)
12
+ app = proc { [200, {"Content-Type" => "text/plain"}, [body]] }
13
+ described_class.new(Rack::Lint.new(Rack::Head.new(app)), :Host => host, :Port => port)
12
14
  end
13
15
 
14
16
  it "runs a basic Hello World app" do
@@ -19,4 +21,23 @@ describe Reel::Rack::Server do
19
21
 
20
22
  subject.terminate
21
23
  end
24
+
25
+ it "success with basic HTTP methods" do
26
+ # Hax to wait for server to be started
27
+ subject.inspect
28
+
29
+ uri = URI("http://#{host}:#{port}/")
30
+ http = Net::HTTP.new(uri.host, uri.port)
31
+ http.set_debug_output($stderr)
32
+
33
+ expect(http.request_get(uri.path).body).to eq body
34
+ expect(http.request_head(uri.path).body).to eq nil
35
+
36
+ expect(http.send_request('POST', uri.path, "test").body).to eq body
37
+ expect(http.send_request('PUT', uri.path, "test").body).to eq body
38
+ expect(http.send_request('PATCH', uri.path, "test").body).to eq body
39
+ expect(http.send_request('DELETE', uri.path).body).to eq body
40
+
41
+ subject.terminate
42
+ end
22
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reel-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -9,76 +9,76 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-21 00:00:00.000000000 Z
12
+ date: 2014-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: reel
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.4.0
20
+ version: 0.5.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.4.0
27
+ version: 0.5.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rack
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.4.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.4.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.3'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.3'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: Rack adapter for Reel
@@ -89,9 +89,9 @@ executables:
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
- - .gitignore
93
- - .rspec
94
- - .travis.yml
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".travis.yml"
95
95
  - CHANGES.md
96
96
  - Gemfile
97
97
  - LICENSE.txt
@@ -119,20 +119,21 @@ require_paths:
119
119
  - lib
120
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - '>='
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.0.6
132
+ rubygems_version: 2.2.0
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Rack adapter for Reel, a Celluloid::IO web server
136
136
  test_files:
137
137
  - spec/reel/rack/server_spec.rb
138
138
  - spec/spec_helper.rb
139
+ has_rdoc: