devproxy 0.4.0 → 0.5.0
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.
- data/lib/devproxy/cli.rb +2 -2
- data/lib/devproxy/connection.rb +2 -2
- data/lib/devproxy/options.rb +0 -1
- data/lib/devproxy/session.rb +3 -1
- data/lib/devproxy/version.rb +1 -1
- data/spec/cli_spec.rb +2 -2
- data/spec/options_spec.rb +3 -3
- metadata +4 -4
data/lib/devproxy/cli.rb
CHANGED
@@ -55,7 +55,7 @@ module Devproxy
|
|
55
55
|
opts.separator ""
|
56
56
|
opts.separator " user: \tDevproxy username."
|
57
57
|
opts.separator " proxy:\tThe name of the proxy you want to connect to (without the domain)."
|
58
|
-
opts.separator " \tDefaults to
|
58
|
+
opts.separator " \tDefaults to the user's default proxy."
|
59
59
|
opts.separator " \texample: 'foo' for tunneling 'foo.devproxy.io'"
|
60
60
|
|
61
61
|
opts.separator ""
|
@@ -99,7 +99,7 @@ module Devproxy
|
|
99
99
|
end
|
100
100
|
opts.parse!(argv)
|
101
101
|
options.user = argv[0]
|
102
|
-
options.proxy = argv[1]
|
102
|
+
options.proxy = argv[1]
|
103
103
|
unless options.valid?
|
104
104
|
puts opts
|
105
105
|
exit
|
data/lib/devproxy/connection.rb
CHANGED
@@ -22,8 +22,8 @@ module Devproxy
|
|
22
22
|
@session.stop! if @session
|
23
23
|
end
|
24
24
|
|
25
|
-
def on_connected
|
26
|
-
$stdout.puts "Tunneling requests from https://#{options.
|
25
|
+
def on_connected(proxy)
|
26
|
+
$stdout.puts "Tunneling requests from https://#{proxy}.#{options.host} to #{options.listen} port #{options.port}"
|
27
27
|
end
|
28
28
|
|
29
29
|
def on_heartbeat data
|
data/lib/devproxy/options.rb
CHANGED
data/lib/devproxy/session.rb
CHANGED
@@ -7,6 +7,7 @@ module Devproxy
|
|
7
7
|
class Error::Authentication < Error ; end
|
8
8
|
|
9
9
|
HEARTBEAT = "HEARTBEAT"
|
10
|
+
CONNECT = "CONNECT:"
|
10
11
|
|
11
12
|
def shutdown!
|
12
13
|
ssh.shutdown!
|
@@ -27,6 +28,8 @@ module Devproxy
|
|
27
28
|
if stream == :stdout
|
28
29
|
if data.start_with?(HEARTBEAT)
|
29
30
|
connection.on_heartbeat(data)
|
31
|
+
elsif data.start_with?(CONNECT)
|
32
|
+
connection.on_connected(data[(CONNECT.size)..-1].chomp)
|
30
33
|
else
|
31
34
|
connection.on_stdout(data)
|
32
35
|
end
|
@@ -37,7 +40,6 @@ module Devproxy
|
|
37
40
|
channel.on_close do
|
38
41
|
connection.on_close
|
39
42
|
end
|
40
|
-
connection.on_connected
|
41
43
|
new(ssh)
|
42
44
|
rescue Net::SSH::AuthenticationFailed
|
43
45
|
raise Error::Authentication, "Authentication Failed: Invalid username or SSH key"
|
data/lib/devproxy/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe Devproxy::CLI do
|
3
3
|
describe "#parse" do
|
4
|
-
it "should
|
4
|
+
it "should not have a default name" do
|
5
5
|
options = parse("foo")
|
6
6
|
expect(options.user).to eq("foo")
|
7
|
-
expect(options.proxy).to
|
7
|
+
expect(options.proxy).to be_nil
|
8
8
|
end
|
9
9
|
it "should accept a different proxy name" do
|
10
10
|
options = parse("foo","bar")
|
data/spec/options_spec.rb
CHANGED
@@ -17,11 +17,11 @@ describe Devproxy::Options do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "valid?" do
|
20
|
-
it "should require a
|
21
|
-
expect(default_options(:
|
20
|
+
it "should not require a proxy" do
|
21
|
+
expect(default_options(:user => "foo")).to be_valid
|
22
22
|
end
|
23
23
|
it "should require a username" do
|
24
|
-
expect(default_options(:
|
24
|
+
expect(default_options(:proxy => "bar")).to_not be_valid
|
25
25
|
end
|
26
26
|
it "should only need a username and proxy" do
|
27
27
|
expect(default_options(:proxy => "foo", :user => "bar")).to be_valid
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devproxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: -2796530892309419750
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
segments:
|
97
97
|
- 0
|
98
|
-
hash:
|
98
|
+
hash: -2796530892309419750
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
101
|
rubygems_version: 1.8.25
|