rack-tunnel 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. data/lib/rack/tunnel.rb +20 -20
  2. metadata +4 -4
@@ -4,7 +4,7 @@ require 'open4'
4
4
 
5
5
  module Rack
6
6
  class Tunnel
7
- VERSION = '0.1.0'
7
+ VERSION = '0.1.1'
8
8
  HEADER = 'X-Tunnel-Uri'
9
9
 
10
10
  def initialize(app, uri)
@@ -21,7 +21,7 @@ module Rack
21
21
  end
22
22
 
23
23
  def establish_tunnel(local_port)
24
- pid, _ = Open4.popen4(command(local_port))
24
+ pid, _ = Open4.popen4(*command(local_port))
25
25
 
26
26
  at_exit do
27
27
  Process.kill(9, pid)
@@ -34,29 +34,29 @@ module Rack
34
34
 
35
35
  def command(local_port)
36
36
  cmd = %w"ssh"
37
- cmd << "-R 0.0.0.0:#{@uri.port}:localhost:#{local_port}"
37
+ cmd << "-R" << "0.0.0.0:#{@uri.port}:localhost:#{local_port}"
38
38
  cmd << @uri.host
39
- cmd << "-l #{@uri.user}"
40
- cmd << "-o TCPKeepAlive=yes"
41
- cmd << "-o ServerAliveInterval=30"
42
- cmd << "-o ServerAliveCountMax=10"
43
- cmd << "-o GatewayPorts=yes"
39
+ cmd << "-l" << @uri.user
40
+ cmd << "-o" << "TCPKeepAlive=yes"
41
+ cmd << "-o" << "ServerAliveInterval=30"
42
+ cmd << "-o" << "ServerAliveCountMax=10"
43
+ cmd << "-o" << "GatewayPorts=yes"
44
44
  cmd << "-N"
45
45
 
46
- cmd.join(' ')
46
+ cmd
47
47
  end
48
48
 
49
- def wait_for_tunnel
50
- Timeout::timeout(30) do
51
- begin
52
- return TCPSocket.new(@uri.host, @uri.port)
53
- rescue Errno::ECONNREFUSED
54
- retry
55
- rescue => e
56
- raise Error, e.message
57
- end
58
- end
59
- end
49
+ def wait_for_tunnel
50
+ Timeout::timeout(30) do
51
+ begin
52
+ return TCPSocket.new(@uri.host, @uri.port)
53
+ rescue Errno::ECONNREFUSED
54
+ retry
55
+ rescue => e
56
+ raise Error, e.message
57
+ end
58
+ end
59
+ end
60
60
 
61
61
  class Error < StandardError ; end
62
62
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-tunnel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Burkert
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-17 00:00:00 -07:00
18
+ date: 2010-10-18 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency