ngrok-tunnel 2.0.21 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/lib/ngrok/tunnel.rb +11 -3
- data/lib/ngrok/tunnel/version.rb +1 -1
- data/spec/tunnel/tunnel_spec.rb +32 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4744a8f70e339c7390520de791b624d36c167b4f
|
4
|
+
data.tar.gz: 51739d7cdb5f89fd86d7cfb6376571d563b12cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 966afd8e4d1b6f87438ba320d5c06f4229b65981470f345245c0694b0028041e00da2a6de0a1f98079478b4f30f9dc2a5c6e729401c3b21bf5d790dcecfe5e24
|
7
|
+
data.tar.gz: 2ebf404553a5d007937b7bbf35e10f45e4d3932b8d8e09ffb18f4897ace33d7d485d8ec3f425ed9cffec0cde8919c40da62778c5a895f4e9ca966498ee9fcb0b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -36,10 +36,10 @@ Ngrok::Tunnel.port
|
|
36
36
|
|
37
37
|
# ngrok external url
|
38
38
|
Ngrok::Tunnel.ngrok_url
|
39
|
-
=> "http://aaa0e65.ngrok.
|
39
|
+
=> "http://aaa0e65.ngrok.io"
|
40
40
|
|
41
41
|
Ngrok::Tunnel.ngrok_url_https
|
42
|
-
=> "https://aaa0e65.ngrok.
|
42
|
+
=> "https://aaa0e65.ngrok.io"
|
43
43
|
|
44
44
|
Ngrok::Tunnel.running?
|
45
45
|
=> true
|
@@ -63,7 +63,7 @@ Ngrok::Tunnel.stop
|
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
# ngrok custom parameters
|
66
|
-
Ngrok::Tunnel.start(
|
66
|
+
Ngrok::Tunnel.start(addr: 'foo.dev:80',
|
67
67
|
subdomain: 'MY_SUBDOMAIN',
|
68
68
|
hostname: 'MY_HOSTNAME',
|
69
69
|
authtoken: 'MY_TOKEN',
|
data/lib/ngrok/tunnel.rb
CHANGED
@@ -13,7 +13,10 @@ module Ngrok
|
|
13
13
|
attr_reader :pid, :ngrok_url, :ngrok_url_https, :status
|
14
14
|
|
15
15
|
def init(params = {})
|
16
|
-
|
16
|
+
# map old key 'port' to 'addr' to maintain backwards compatibility with versions 2.0.21 and earlier
|
17
|
+
params[:addr] = params.delete(:port) if params.key?(:port)
|
18
|
+
|
19
|
+
@params = {addr: 3001, timeout: 10, config: '/dev/null'}.merge(params)
|
17
20
|
@status = :stopped unless @status
|
18
21
|
end
|
19
22
|
|
@@ -49,8 +52,13 @@ module Ngrok
|
|
49
52
|
@status == :stopped
|
50
53
|
end
|
51
54
|
|
55
|
+
def addr
|
56
|
+
@params[:addr]
|
57
|
+
end
|
58
|
+
|
52
59
|
def port
|
53
|
-
|
60
|
+
return addr if addr.is_a?(Numeric)
|
61
|
+
addr.split(":").last.to_i
|
54
62
|
end
|
55
63
|
|
56
64
|
def log
|
@@ -77,7 +85,7 @@ module Ngrok
|
|
77
85
|
exec_params << "-subdomain=#{@params[:subdomain]} " if @params[:subdomain]
|
78
86
|
exec_params << "-hostname=#{@params[:hostname]} " if @params[:hostname]
|
79
87
|
exec_params << "-inspect=#{@params[:inspect]} " if @params.has_key? :inspect
|
80
|
-
exec_params << "-config=#{@params[:config]} #{@params[:
|
88
|
+
exec_params << "-config=#{@params[:config]} #{@params[:addr]} > #{@params[:log].path}"
|
81
89
|
end
|
82
90
|
|
83
91
|
def fetch_urls
|
data/lib/ngrok/tunnel/version.rb
CHANGED
data/spec/tunnel/tunnel_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ngrok::Tunnel do
|
3
2
|
|
4
3
|
describe "Before start" do
|
@@ -37,10 +36,14 @@ describe Ngrok::Tunnel do
|
|
37
36
|
expect(Ngrok::Tunnel.status).to eq :running
|
38
37
|
end
|
39
38
|
|
40
|
-
it "should
|
39
|
+
it "should still support port" do
|
41
40
|
expect(Ngrok::Tunnel.port).to eq(3001)
|
42
41
|
end
|
43
42
|
|
43
|
+
it "should match local_addr" do
|
44
|
+
expect(Ngrok::Tunnel.addr).to eq(3001)
|
45
|
+
end
|
46
|
+
|
44
47
|
it "should have valid ngrok_url" do
|
45
48
|
expect(Ngrok::Tunnel.ngrok_url).to be =~ /http:\/\/.*ngrok\.io$/
|
46
49
|
end
|
@@ -67,21 +70,44 @@ describe Ngrok::Tunnel do
|
|
67
70
|
|
68
71
|
describe "Custom subdomain" do
|
69
72
|
it "should fail without authtoken" do
|
70
|
-
expect {Ngrok::Tunnel.start(subdomain: 'test-subdomain')}.to raise_error
|
73
|
+
expect {Ngrok::Tunnel.start(subdomain: 'test-subdomain')}.to raise_error Ngrok::Error
|
71
74
|
end
|
72
75
|
|
73
76
|
it "should fail with incorrect authtoken" do
|
74
|
-
expect {Ngrok::Tunnel.start(subdomain: 'test-subdomain', authtoken: 'incorrect_token')}.to raise_error
|
77
|
+
expect {Ngrok::Tunnel.start(subdomain: 'test-subdomain', authtoken: 'incorrect_token')}.to raise_error Ngrok::Error
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
78
81
|
describe "Custom hostname" do
|
79
82
|
it "should fail without authtoken" do
|
80
|
-
expect {Ngrok::Tunnel.start(hostname: 'example.com')}.to raise_error
|
83
|
+
expect {Ngrok::Tunnel.start(hostname: 'example.com')}.to raise_error Ngrok::Error
|
81
84
|
end
|
82
85
|
|
83
86
|
it "should fail with incorrect authtoken" do
|
84
|
-
expect {Ngrok::Tunnel.start(hostname: 'example.com', authtoken: 'incorrect_token')}.to raise_error
|
87
|
+
expect {Ngrok::Tunnel.start(hostname: 'example.com', authtoken: 'incorrect_token')}.to raise_error Ngrok::Error
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "Custom addr" do
|
92
|
+
it "should map port param to addr" do
|
93
|
+
port = 10010
|
94
|
+
Ngrok::Tunnel.start(port: port)
|
95
|
+
expect(Ngrok::Tunnel.addr).to eq port
|
96
|
+
Ngrok::Tunnel.stop
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should return just the port when the address contains a host" do
|
100
|
+
addr = '192.168.0.5:10010'
|
101
|
+
Ngrok::Tunnel.start(addr: addr)
|
102
|
+
expect(Ngrok::Tunnel.port).to eq 10010
|
103
|
+
Ngrok::Tunnel.stop
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should support remote addresses" do
|
107
|
+
addr = '192.168.0.5:10010'
|
108
|
+
Ngrok::Tunnel.start(addr: addr)
|
109
|
+
expect(Ngrok::Tunnel.addr).to eq addr
|
110
|
+
Ngrok::Tunnel.stop
|
85
111
|
end
|
86
112
|
end
|
87
113
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ngrok-tunnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Bogdanovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|