hostrich 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: 637748f6b1009f5874056cee3fb09f09e9a3acf8
4
- data.tar.gz: d68d76d257965d8ff2da09a76124ab8561c194a2
3
+ metadata.gz: fa4e3e96a9692ca3bb53ce5408f139c9ed51f1a1
4
+ data.tar.gz: 170021e024e461c62dd02cf61039dfa3d73af6a7
5
5
  SHA512:
6
- metadata.gz: 2b61b34927dbfad8b7c8c01d1c7c290a7bf3250dfb24be333ccfba741bf2a679f3cc11596f00560d1366a603d13ae05c482ea30efb62b5d7fa7e350cef939dfe
7
- data.tar.gz: 7204c9c21f1b6cef6ec948833a20834f1825fb5057157aeae305bf3520dd487aed345600ee8772a75a79bf065021d8a5d8a619008bae37d632249768a34facd7
6
+ metadata.gz: a95b457cdde2b09f7bef015fd933e6751b23fcc787bcb53c22520b40f6ce7335b41ac70a2e7e8b2c172c50aa2e075e72e54ded9465722a7992a2dd5f2960b83d
7
+ data.tar.gz: 86ce4fc2137a9869261c939db61e6c81656f59f15a7a8c2f268a9135666463155ec95c5a6c4d4c54def716797fd191508586e961bcd7dff35fdc88548fd2ea96
data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --color
2
- --format progress
data/lib/hostrich.rb CHANGED
@@ -38,9 +38,12 @@ class Hostrich
38
38
  status, headers, body = @app.call(env)
39
39
  body.close if body.respond_to? :close
40
40
 
41
+ chunks = []
42
+ body.each { |chunk| chunks << chunk.to_s }
43
+ body = chunks.join
44
+
41
45
  # Add current host suffix in all response bodies, so that occurences of http://example.com
42
46
  # appear as http://example.com.dev or http://example.com.127.0.0.1.xip.io in the browser.
43
- body = Array(body.each(&:to_s)).join
44
47
  body = [add_suffix(body, suffix)]
45
48
 
46
49
  # Do the same in response headers. This is important for cookies and redirects.
@@ -1,3 +1,3 @@
1
1
  class Hostrich
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -11,6 +11,8 @@ describe Hostrich do
11
11
  [302, { 'Location' => 'http://foo.com/index.html' }, []]
12
12
  when '/cookie'
13
13
  [200, { 'Set-Cookie' => 'some_param=foo.com/index.html; Path=/; Domain=.foo.com' }, ['Cookie!']]
14
+ when '/version.rb'
15
+ Rack::File.new('lib/hostrich').call(env)
14
16
  else
15
17
  [200, {}, ['Welcome to foo.com or foo.com.dev, not foo.comzle, not ffoo.com and not bar.io']]
16
18
  end
@@ -31,6 +33,11 @@ describe Hostrich do
31
33
  response = request.get('/cookie', 'HTTP_HOST' => 'foo.com.dev')
32
34
  expect(response.headers['Set-Cookie']).to eq 'some_param=foo.com.dev/index.html; Path=/; Domain=.foo.com.dev'
33
35
  end
36
+
37
+ it 'works with Rack::File' do
38
+ response = request.get('/version.rb', 'HTTP_HOST' => 'foo.com.dev')
39
+ expect(response.body).to include "class Hostrich\n VERSION"
40
+ end
34
41
  end
35
42
 
36
43
  context 'passing host as a string' do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'hostrich'
2
2
 
3
3
  RSpec.configure do |config|
4
- config.treat_symbols_as_metadata_keys_with_true_values = true
5
4
  config.run_all_when_everything_filtered = true
6
5
  config.filter_run :focus
7
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hostrich
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
  - Rafaël Blais Masson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-02 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.2.0
107
+ rubygems_version: 2.4.5
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Hostrich is a Rack middleware that eases multi-domain web app development.