liquid-proxy 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67f7c456ca6d8125571fc4776efd6d0acf4f5885
4
+ data.tar.gz: 0f9d435dd3d7d1b6d687aae5e40616e2411d69d7
5
+ SHA512:
6
+ metadata.gz: f932ccf657b8bf9f723543706046e4546c2c71162c95491615105d14d3ed18c53b256bdecc06c80f5efe2e458ec1ffd1609dc81f9c7442ba2c8fa1b620e2eb8d
7
+ data.tar.gz: e4725820b2197d5c301c5fdf9cc9f33beadcdb9cde4718b9969824ab20a9833c1f4e8ca4db143ccce7d1a80f9c608d9376e40c522c137251e3f7591f1c1764ec
@@ -1,6 +1,7 @@
1
1
  rvm:
2
- - 1.9.2
3
- - 1.9.3
2
+ - 2.3.1
3
+ - 2.2.5
4
+ - 2.1.9
4
5
  script: "bundle exec rspec --color spec && bundle exec cucumber --format progress"
5
6
  branches:
6
7
  only:
@@ -1,6 +1,7 @@
1
1
  # Liquid Proxy
2
2
 
3
3
  [![Build status](https://secure.travis-ci.org/artemave/liquid-proxy.png)](https://secure.travis-ci.org/artemave/liquid-proxy)
4
+ [![Gem Version](https://badge.fury.io/rb/liquid-proxy.png)](http://badge.fury.io/rb/liquid-proxy)
4
5
 
5
6
  ## Overview
6
7
 
@@ -78,4 +79,4 @@ If you are not using ruby, it is possible to run liquid-proxy as a standalone pr
78
79
 
79
80
  ## Author
80
81
 
81
- [Artem Avetisyan](https://github.com/artemave)
82
+ [Artem Avetisyan](https://github.com/artemave)
@@ -23,7 +23,7 @@ class LiquidProxy
23
23
  private
24
24
 
25
25
  def http
26
- @http ||= Net::HTTP.new('127.0.0.1', LiquidProxy.port)
26
+ @http ||= Net::HTTP.new('localhost', LiquidProxy.port)
27
27
  end
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  class LiquidProxy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -3,7 +3,7 @@ require 'socket'
3
3
  module Utils
4
4
  class PortExplorer
5
5
  def self.port_occupied?(port)
6
- !!Net::HTTP.get('127.0.0.1', '/', port)
6
+ !!Net::HTTP.get('localhost', '/', port)
7
7
  rescue => e
8
8
  !e.is_a?(Errno::ECONNREFUSED)
9
9
  else
@@ -22,9 +22,9 @@ describe LiquidProxy::ApiController do
22
22
 
23
23
  it 'adds headers to inject' do
24
24
  new_headers = {'X_HACK' => 'Boom'}
25
- conn.stub(:send_data => nil, :close_connection_after_writing => nil, :parser => stub.as_null_object)
25
+ conn.stub(:send_data => nil, :close_connection_after_writing => nil, :parser => double.as_null_object)
26
26
  conn.stub(:body => new_headers.to_json)
27
- conn.stub(:headers_to_inject => (headers_to_inject = mock))
27
+ conn.stub(:headers_to_inject => (headers_to_inject = double))
28
28
 
29
29
  headers_to_inject.should_receive(:merge!).with(new_headers)
30
30
  conn.process_api_call
@@ -33,7 +33,7 @@ describe LiquidProxy::ApiController do
33
33
  it 'clears off headers to inject if api request method is DELETE' do
34
34
  conn.stub(:send_data => nil, :close_connection_after_writing => nil)
35
35
  conn.stub_chain('parser.http_method').and_return('DELETE')
36
- conn.stub(:headers_to_inject => (headers_to_inject = mock))
36
+ conn.stub(:headers_to_inject => (headers_to_inject = double))
37
37
  headers_to_inject.should_receive(:clear)
38
38
  conn.process_api_call
39
39
  end
@@ -41,7 +41,7 @@ describe LiquidProxy::ApiController do
41
41
  it 'relays back to client' do
42
42
  response = "response_#{Time.now}"
43
43
  HTTPTools::Builder.stub(:response).with(:ok).and_return(response)
44
- conn.stub(:headers_to_inject => stub.as_null_object, :parser => stub.as_null_object)
44
+ conn.stub(:headers_to_inject => double.as_null_object, :parser => double.as_null_object)
45
45
 
46
46
  conn.should_receive(:send_data).with(response).ordered
47
47
  conn.should_receive(:close_connection_after_writing).ordered
@@ -14,7 +14,7 @@ describe LiquidProxy::ConnectionProcessor do
14
14
 
15
15
  it 'feeds connection data to parser' do
16
16
  data = 'data'
17
- Http::Parser.stub(:new).and_return(parser = mock)
17
+ Http::Parser.stub(:new).and_return(parser = double)
18
18
  parser.should_receive(:<<).with(data)
19
19
  conn.process_data(data)
20
20
  end
@@ -22,11 +22,11 @@ describe LiquidProxy::ConnectionProcessor do
22
22
  it 'passes request through' do
23
23
  HEADERS_TO_INJECT = {} unless defined?(HEADERS_TO_INJECT)
24
24
  new_request = "new_request#{Time.now}"
25
- parser = stub(:headers => {'Host' => 'localhost'})
25
+ parser = double(:headers => {'Host' => 'localhost'})
26
26
  conn.stub(
27
- :body => (body = mock),
27
+ :body => (body = double),
28
28
  :parser => parser,
29
- :request_builder => (request_builder = stub),
29
+ :request_builder => (request_builder = double),
30
30
  :api_call? => false
31
31
  )
32
32
  request_builder.stub(:build).with(conn.parser, conn.body).and_return(new_request)
@@ -42,7 +42,7 @@ describe LiquidProxy::ConnectionProcessor do
42
42
 
43
43
  conn.stub(:server => nil, :relay_to_servers => nil, :api_call? => false)
44
44
  conn.stub(:headers_to_inject => headers_to_inject)
45
- conn.parser.stub(:headers).and_return(headers = mock.as_null_object)
45
+ conn.parser.stub(:headers).and_return(headers = double.as_null_object)
46
46
 
47
47
  headers.should_receive(:merge!).with(headers_to_inject)
48
48
 
@@ -5,7 +5,7 @@ require 'liquid-proxy/connection_processor'
5
5
  describe LiquidProxy::Connection do
6
6
  context "em-proxy connection setup" do
7
7
  it 'feeds data to connection processor' do
8
- conn = mock
8
+ conn = double
9
9
  conn.should_receive(:extend).with(LiquidProxy::ConnectionProcessor) # this assert stinks?
10
10
  conn.should_receive(:on_data) do |&block|
11
11
  conn.should_receive(:process_data).with("data")
@@ -34,7 +34,7 @@ describe LiquidProxy do
34
34
 
35
35
  context 'header injection' do
36
36
  let :headers_to_inject do
37
- mock('headers_to_inject')
37
+ double('headers_to_inject')
38
38
  end
39
39
 
40
40
  before do
@@ -4,7 +4,7 @@ require 'liquid-proxy/request_builder'
4
4
  describe LiquidProxy::RequestBuilder do
5
5
  it 'builds HTTP request' do
6
6
  body = '_with_body'
7
- parser = stub(:http_method => 'method', :headers => {'Host' => 'host'}, :request_url => 'url')
7
+ parser = double(:http_method => 'method', :headers => {'Host' => 'host'}, :request_url => 'url')
8
8
  HTTPTools::Builder.stub(:request).with('method', 'host', 'url', {'Host' => 'host'}).and_return('new_request')
9
9
 
10
10
  LiquidProxy::RequestBuilder.new.build(parser, body).should == 'new_request_with_body'
@@ -8,7 +8,7 @@ describe LiquidProxy::ServerRelay do
8
8
 
9
9
  it 'relays to server usging host and port from incoming request' do
10
10
  host, port = 'remotehost', 9876
11
- conn.stub(:parser => stub(:headers => {'Host' => "#{host}:#{port}"}))
11
+ conn.stub(:parser => double(:headers => {'Host' => "#{host}:#{port}"}))
12
12
 
13
13
  conn.should_receive(:server).with(anything, :host => host, :port => port).ordered
14
14
  conn.should_receive(:relay_to_servers).with('new_request').ordered
@@ -17,7 +17,7 @@ describe LiquidProxy::ServerRelay do
17
17
  end
18
18
 
19
19
  it 'uses port 80 by default' do
20
- conn.stub(:relay_to_servers => nil, :parser => stub(:headers => {'Host' => "localhost"}))
20
+ conn.stub(:relay_to_servers => nil, :parser => double(:headers => {'Host' => "localhost"}))
21
21
 
22
22
  conn.should_receive(:server).with(anything, :host => 'localhost', :port => 80)
23
23
 
@@ -16,7 +16,7 @@ describe LiquidProxy::Service do
16
16
  end
17
17
 
18
18
  it 'does nothing if subprocess already running' do
19
- LiquidProxy::Subprocess.should_receive(:new).once.and_return(stub(:alive? => true))
19
+ LiquidProxy::Subprocess.should_receive(:new).once.and_return(double(:alive? => true))
20
20
 
21
21
  LiquidProxy::Service.start
22
22
  LiquidProxy::Service.start
@@ -25,7 +25,7 @@ describe LiquidProxy::Service do
25
25
 
26
26
  it 'knows when it is up if subprocess is alive and service port is occupied' do
27
27
  port = 1234
28
- LiquidProxy::Subprocess.stub(:new).and_return(sp = stub(:alive? => true))
28
+ LiquidProxy::Subprocess.stub(:new).and_return(sp = double(:alive? => true))
29
29
 
30
30
  sp.should_receive(:alive?)
31
31
  Utils::PortExplorer.should_receive(:port_occupied?).with(port).and_return(true)
@@ -40,7 +40,7 @@ describe LiquidProxy::Service do
40
40
  end
41
41
 
42
42
  it 'if subprocess is not alive' do
43
- LiquidProxy::Subprocess.stub(:new).and_return(sp = stub(:alive? => false))
43
+ LiquidProxy::Subprocess.stub(:new).and_return(sp = double(:alive? => false))
44
44
 
45
45
  sp.should_receive(:alive?)
46
46
  LiquidProxy::Service.start
@@ -49,11 +49,11 @@ describe LiquidProxy::Service do
49
49
 
50
50
  it 'if service port is not occupied' do
51
51
  port = 1234
52
- LiquidProxy::Subprocess.stub(:new).and_return(sp = stub(:alive? => true))
52
+ LiquidProxy::Subprocess.stub(:new).and_return(sp = double(:alive? => true))
53
53
 
54
54
  sp.should_receive(:alive?)
55
55
  Utils::PortExplorer.should_receive(:port_occupied?).with(port).and_return(false)
56
-
56
+
57
57
  LiquidProxy::Service.start(:port => port)
58
58
  LiquidProxy::Service.up?.should == false
59
59
  end
@@ -17,11 +17,12 @@ describe LiquidProxy::Subprocess do
17
17
  ChildProcess.should_receive(:build) do |cmd, *params|
18
18
  cmd.should =~ %r{bin/liquid-proxy}
19
19
  params.should == ["1234"]
20
+ child
20
21
  end
21
22
  LiquidProxy::Subprocess.new(opts)
22
23
  end
23
24
  it 'inherits io and then starts child' do
24
- child.should_receive(:io).ordered.and_return(io = mock)
25
+ child.should_receive(:io).ordered.and_return(io = double)
25
26
  io.should_receive(:inherit!)
26
27
  child.should_receive(:start).ordered
27
28
  LiquidProxy::Subprocess.new
metadata CHANGED
@@ -1,60 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - artemave
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-02-25 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: em-proxy
16
- requirement: &2161576440 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *2161576440
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: http_tools
27
- requirement: &2161575640 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *2161575640
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: http_parser.rb
38
- requirement: &2161575100 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - ">="
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *2161575100
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: childprocess
49
- requirement: &2161574480 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *2161574480
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  description:
59
70
  email:
60
71
  - artemave@gmail.com
@@ -63,9 +74,9 @@ executables:
63
74
  extensions: []
64
75
  extra_rdoc_files: []
65
76
  files:
66
- - .gitignore
67
- - .rspec
68
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
69
80
  - Gemfile
70
81
  - LICENSE
71
82
  - README.markdown
@@ -98,27 +109,26 @@ files:
98
109
  - spec/support/reset-singleton.rb
99
110
  homepage: https://github.com/artemave/liquid-proxy
100
111
  licenses: []
112
+ metadata: {}
101
113
  post_install_message:
102
114
  rdoc_options: []
103
115
  require_paths:
104
116
  - lib
105
117
  required_ruby_version: !ruby/object:Gem::Requirement
106
- none: false
107
118
  requirements:
108
- - - ! '>='
119
+ - - ">="
109
120
  - !ruby/object:Gem::Version
110
121
  version: '0'
111
122
  required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
123
  requirements:
114
- - - ! '>='
124
+ - - ">="
115
125
  - !ruby/object:Gem::Version
116
126
  version: '0'
117
127
  requirements: []
118
128
  rubyforge_project: liquid-proxy
119
- rubygems_version: 1.8.10
129
+ rubygems_version: 2.5.1
120
130
  signing_key:
121
- specification_version: 3
131
+ specification_version: 4
122
132
  summary: http proxy with api for modifying requests passing through
123
133
  test_files:
124
134
  - features/change_headers.feature
@@ -135,4 +145,3 @@ test_files:
135
145
  - spec/spec_helper.rb
136
146
  - spec/subprocess_spec.rb
137
147
  - spec/support/reset-singleton.rb
138
- has_rdoc: