Created
May 3, 2011 07:30
-
-
Save pogodan/952951 to your computer and use it in GitHub Desktop.
thor/pow reverse SSH tunnel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tunnel < Thor | |
method_options :environment => "development", :aliases => "-e", :desc => "Config environment" | |
desc "start", "Start an ssh tunnel" | |
def start | |
command = "ssh -nNT -g -R *:#{tunnel['public_port']}:0.0.0.0:#{tunnel['local_port']} #{tunnel['username']}@#{tunnel['public_host']}" | |
puts "executing #{command}" | |
exec command | |
end | |
private | |
def tunnel | |
@tunnel ||= YAML.load_file(File.expand_path('~/.tunnel.yml'))[options[:environment]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment