Merge pull request #43 from lastquestion/master
Pull request to explain ./localtunnel_callback
This commit is contained in:
commit
367d3f6977
|
@ -47,6 +47,11 @@ tunnels through to the url given in that status message "publicly
|
|||
accessible from..." for as long as the command is running. The tunnel
|
||||
is closed if the command exits.
|
||||
|
||||
Localtunnel will search for the file .localtunnel_callback in the CWD.
|
||||
If it exists, it will execute the file with one argument, the public
|
||||
endpoint, when the tunnel is opened. This is useful for starting other
|
||||
tools or processes that need the name of the endpoint.
|
||||
|
||||
== Contributors
|
||||
|
||||
andyl (andy@r210.com)
|
||||
|
|
3
Rakefile
3
Rakefile
|
@ -2,12 +2,11 @@ require 'rubygems'
|
|||
require 'rake'
|
||||
require 'echoe'
|
||||
|
||||
Echoe.new('localtunnel', '0.3') do |p|
|
||||
Echoe.new('localtunnel', '0.3.1') do |p|
|
||||
p.description = "instant public tunnel to your local web server"
|
||||
p.url = "http://github.com/progrium/localtunnel"
|
||||
p.author = "Jeff Lindsay"
|
||||
p.email = "jeff.lindsay@twilio.com"
|
||||
p.has_rdoc = false
|
||||
p.rdoc_pattern = //
|
||||
p.rdoc_options = []
|
||||
p.ignore_pattern = ["tmp/*", "script/*"]
|
||||
|
|
|
@ -28,7 +28,12 @@ require 'localtunnel'
|
|||
|
||||
key = nil
|
||||
options = OptionParser.new do |o|
|
||||
o.banner = "Usage: localtunnel [options] <localport>"
|
||||
o.banner =
|
||||
"Usage: localtunnel [options] <localport>\n\n" +
|
||||
"The file .localtunnel_callback, if it exists in the current working directory,\n"+
|
||||
"will be executed with the tunnel endpoint as the first argument once the \n" +
|
||||
"tunnel is started\n\n"
|
||||
|
||||
o.on("-k", "--key FILE", "upload a public key for authentication") do |k|
|
||||
key = File.exist?(k.to_s) ? File.open(k).read : nil
|
||||
end
|
||||
|
@ -44,4 +49,4 @@ end
|
|||
|
||||
t = LocalTunnel::Tunnel.new(local_port, key)
|
||||
t.register_tunnel
|
||||
t.start_tunnel
|
||||
t.start_tunnel
|
||||
|
|
|
@ -47,7 +47,7 @@ class LocalTunnel::Tunnel
|
|||
gateway.open_remote(port.to_i, '127.0.0.1', tunnel['through_port'].to_i) do |rp,rh|
|
||||
puts " " << tunnel['banner'] if tunnel.has_key? 'banner'
|
||||
if File.exists?(File.expand_path(SHELL_HOOK_FILE))
|
||||
system "#{SHELL_HOOK_FILE} ""#{tunnel['host']}""" if File.exists?(File.expand_path(SHELL_HOOK_FILE))
|
||||
system "#{File.expand_path(SHELL_HOOK_FILE)} ""#{tunnel['host']}"""
|
||||
if !$?.success?
|
||||
puts " An error occurred executing the callback hook #{SHELL_HOOK_FILE}"
|
||||
puts " (Make sure it is executable)"
|
||||
|
|
Loading…
Reference in New Issue