hsume2-localtunnel 0.3.beta.1 → 0.3.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('hsume2-localtunnel', '0.3.beta.1') do |p|
5
+ Echoe.new('hsume2-localtunnel', '0.3.beta.2') do |p|
6
6
  p.description = "instant public tunnel to your local web server"
7
7
  p.url = "http://github.com/hsume2/localtunnel"
8
8
  p.author = "Jeff Lindsay"
@@ -12,6 +12,6 @@ Echoe.new('hsume2-localtunnel', '0.3.beta.1') do |p|
12
12
  p.rdoc_options = []
13
13
  p.ignore_pattern = ["tmp/*", "script/*"]
14
14
  p.executable_pattern = ["bin/*"]
15
- p.runtime_dependencies = ["json >=1.2.4", "net-ssh >=2.0.22", "net-ssh-gateway >=1.0.1", "sinatra >=1.3.2", "POpen4 >=0.1.4"]
15
+ p.runtime_dependencies = ["json >=1.2.4", "net-ssh >=2.0.22", "net-ssh-gateway >=1.0.1", "sinatra >=1.3.2", "POpen4 >=0.1.4", "twilio-ruby >=3.5.1"]
16
16
  p.development_dependencies = []
17
17
  end
data/bin/localtunnel CHANGED
@@ -24,15 +24,29 @@
24
24
 
25
25
  require 'rubygems'
26
26
  require 'optparse'
27
+ require 'yaml'
27
28
  require 'localtunnel'
28
29
 
29
- key = nil
30
+ key, config = nil, nil
30
31
  options = OptionParser.new do |o|
31
32
  o.banner = "Usage: localtunnel [options] <localport>"
32
33
  o.on("-k", "--key FILE", "upload a public key for authentication") do |k|
33
34
  key = File.exist?(k.to_s) ? File.open(k).read : nil
34
35
  end
35
36
  o.on('-h', "--help", "show this help") { puts o; exit }
37
+ o.on('-c', "--config FILE", "configure for Twilio phone number for localtunnel",
38
+ "Example (YAML):",
39
+ " ---",
40
+ " account_sid: AC...",
41
+ " auth_token: ...",
42
+ " phone_number_sid: PN...",
43
+ " urls:",
44
+ " voice_url: /voice/calls/...",
45
+ " status_callback: /voice/calls/...",
46
+ " voice_fallback_url: /voice/calls/...",
47
+ " sms_url: /voice/calls/...") do |k|
48
+ config = File.exist?(k.to_s) ? YAML::load(File.open(k)) : nil
49
+ end
36
50
  end
37
51
 
38
52
  args = options.parse!
@@ -42,6 +56,6 @@ unless local_port.to_i.between?(1, 65535)
42
56
  exit
43
57
  end
44
58
 
45
- t = LocalTunnel::Tunnel.new(local_port, key)
59
+ t = LocalTunnel::Tunnel.new(local_port, key, config)
46
60
  t.register_tunnel
47
- t.start_tunnel
61
+ t.start_tunnel
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hsume2-localtunnel}
5
- s.version = "0.3.beta.1"
5
+ s.version = "0.3.beta.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jeff Lindsay"]
9
- s.date = %q{2012-01-25}
9
+ s.date = %q{2012-01-26}
10
10
  s.default_executable = %q{localtunnel}
11
11
  s.description = %q{instant public tunnel to your local web server}
12
12
  s.email = %q{jeff.lindsay@twilio.com}
@@ -28,12 +28,14 @@ Gem::Specification.new do |s|
28
28
  s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.0.1"])
29
29
  s.add_runtime_dependency(%q<sinatra>, [">= 1.3.2"])
30
30
  s.add_runtime_dependency(%q<POpen4>, [">= 0.1.4"])
31
+ s.add_runtime_dependency(%q<twilio-ruby>, [">= 3.5.1"])
31
32
  else
32
33
  s.add_dependency(%q<json>, [">= 1.2.4"])
33
34
  s.add_dependency(%q<net-ssh>, [">= 2.0.22"])
34
35
  s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.1"])
35
36
  s.add_dependency(%q<sinatra>, [">= 1.3.2"])
36
37
  s.add_dependency(%q<POpen4>, [">= 0.1.4"])
38
+ s.add_dependency(%q<twilio-ruby>, [">= 3.5.1"])
37
39
  end
38
40
  else
39
41
  s.add_dependency(%q<json>, [">= 1.2.4"])
@@ -41,5 +43,6 @@ Gem::Specification.new do |s|
41
43
  s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.1"])
42
44
  s.add_dependency(%q<sinatra>, [">= 1.3.2"])
43
45
  s.add_dependency(%q<POpen4>, [">= 0.1.4"])
46
+ s.add_dependency(%q<twilio-ruby>, [">= 3.5.1"])
44
47
  end
45
48
  end
@@ -5,6 +5,7 @@ require 'net/http'
5
5
  require 'uri'
6
6
  require 'json'
7
7
  require 'open4'
8
+ require 'twilio-ruby'
8
9
 
9
10
  require 'localtunnel/net_ssh_gateway_patch'
10
11
 
@@ -16,12 +17,13 @@ class LocalTunnel::Tunnel
16
17
 
17
18
  SHELL_HOOK_FILE = "./.localtunnel_callback"
18
19
 
19
- attr_accessor :port, :key, :host
20
+ attr_accessor :port, :key, :host, :config
20
21
 
21
- def initialize(port, key)
22
+ def initialize(port, key, config)
22
23
  @port = port
23
24
  @key = key
24
25
  @host = ""
26
+ @config = config
25
27
  end
26
28
 
27
29
  def register_tunnel(key=@key)
@@ -66,6 +68,19 @@ class LocalTunnel::Tunnel
66
68
  puts " (Make sure it is executable)"
67
69
  end
68
70
  end
71
+
72
+ if @config
73
+ @client = Twilio::REST::Client.new(@config['account_sid'], @config['auth_token'])
74
+ @account = @client.account
75
+ properties = @config['urls'].inject({}) do |urls, k_v|
76
+ k, v = k_v
77
+ urls[k] = URI.join("http://#{tunnel['host']}", v).to_s
78
+ urls
79
+ end
80
+ pn = @account.incoming_phone_numbers.get(@config['phone_number_sid']).update(properties)
81
+ puts " Updated #{pn.phone_number} for localtunnel."
82
+ end
83
+
69
84
  puts " Port #{port} is now publicly accessible from http://#{tunnel['host']} ..."
70
85
 
71
86
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hsume2-localtunnel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196297
4
+ hash: 62196303
5
5
  prerelease: 4
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - beta
10
- - 1
11
- version: 0.3.beta.1
10
+ - 2
11
+ version: 0.3.beta.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Jeff Lindsay
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-25 00:00:00 -08:00
19
+ date: 2012-01-26 00:00:00 -08:00
20
20
  default_executable: localtunnel
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,22 @@ dependencies:
99
99
  version: 0.1.4
100
100
  type: :runtime
101
101
  version_requirements: *id005
102
+ - !ruby/object:Gem::Dependency
103
+ name: twilio-ruby
104
+ prerelease: false
105
+ requirement: &id006 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ hash: 17
111
+ segments:
112
+ - 3
113
+ - 5
114
+ - 1
115
+ version: 3.5.1
116
+ type: :runtime
117
+ version_requirements: *id006
102
118
  description: instant public tunnel to your local web server
103
119
  email: jeff.lindsay@twilio.com
104
120
  executables: