localtunnel 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a4bde484c6c8c5080e9c4d0bd18248ef8ff62c6
4
- data.tar.gz: 1f33eca4f0c3281bbcf90216bb8522df94dfff11
3
+ metadata.gz: 38f2d1bbde7fd341eff4cdc738d6dbefbbbf3587
4
+ data.tar.gz: 586aabaee94ae8fe0541bc165063beff1a690317
5
5
  SHA512:
6
- metadata.gz: 2f8d30e20b6cf805fbce77cb355e64fc63e3d8328bf4c0b7f2d20d1640c414380065652aa0c8269186492af433edd9a505d27a871da4ba6a964dd5eaf5fbf6ab
7
- data.tar.gz: f9f08b7ecd6754a139b3f0889ea8b0be3ec4f97eb86906e3844b5861132761f1d5e437fc55f3bf5b13f79a71e724f79e21b905b7b523023c7a5594c7040be16c
6
+ metadata.gz: 5e139a5442b7f386ffb44581b2bac1888464efcfb0520d58ad60e97c148602f3917575ee663337449fd4c2593b0d6c93e2c8219ad3e56977e11709a28aafae29
7
+ data.tar.gz: 4f1f9e3e3808fe22de86dd8845c22e2585a99c09df460fe71a0b65a2a2a6138eb2fac9b5d27eafb023ac4e109e5c46b7a71a58bebed950201f2a0eb0c58e0bf0
@@ -12,20 +12,18 @@ module Localtunnel
12
12
 
13
13
  log = Tempfile.new("localtunnel")
14
14
  @@pid = Process.spawn(execution_string(log, options))
15
- @@url = parse_url!(log)
16
15
 
17
16
  at_exit { stop } # Ensure process is killed if Ruby exits.
18
17
 
19
- return # Explicitly return nil.
18
+ @@url = parse_url!(log)
20
19
  end
21
20
 
22
21
  def self.stop
23
22
  return unless running?
24
23
 
25
24
  `kill -9 #{@@pid} 1>/dev/null 2>&1` # Can't use Process.kill, since JRuby on Raspbian doesn't support it.
26
- @@pid = nil
27
25
 
28
- return # Explicitly return nil.
26
+ @@pid = nil
29
27
  end
30
28
 
31
29
  def self.running?
@@ -48,22 +46,24 @@ module Localtunnel
48
46
  s << " -s '#{options[:subdomain]}'" if options.key?(:subdomain)
49
47
  s << " -h '#{options[:remote_host]}'" if options.key?(:remote_host)
50
48
  s << " -l '#{options[:local_host]}'" if options.key?(:local_host)
51
- s << " > #{log.path}"
49
+ s << " > #{log.path} 2>&1"
52
50
  end
53
51
 
54
52
  def self.parse_url!(log, max_seconds = 10)
55
53
  max_seconds.times do
56
54
  sleep 1
57
- raise ClientConnectionFailedError unless running?
58
-
59
55
  log.rewind
60
- if match_data = log.read.match(/^your url is: (.*)$/)
61
- return match_data.captures[0]
56
+ log_data = log.read
57
+
58
+ if match_data = log_data.match(/^your url is: (.*)$/)
59
+ return match_data.captures.first
60
+ elsif log_data.match(/^Error: (.*)$/)
61
+ raise ClientConnectionFailedError
62
62
  end
63
63
  end
64
64
 
65
65
  stop
66
- raise ClientConnectionFailedError
66
+ raise ClientConnectionFailedError # Timeout.
67
67
  end
68
68
  end
69
69
 
@@ -1,3 +1,3 @@
1
1
  module Localtunnel
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localtunnel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swinburne Software Innovation Lab