Class: VagrantPlugins::RemoteForward::Setup
- Inherits:
-
Object
- Object
- VagrantPlugins::RemoteForward::Setup
- Defined in:
- lib/vagrant-remote-forward/setup.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Setup
constructor
A new instance of Setup.
Constructor Details
#initialize(app, env) ⇒ Setup
Returns a new instance of Setup.
4 5 6 |
# File 'lib/vagrant-remote-forward/setup.rb', line 4 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vagrant-remote-forward/setup.rb', line 8 def call(env) if forwards = env[:machine].config.remote_forward.forwards # TODO: Find a public API for this instead of relying on protected # methods env[:machine].communicate.send(:connect) do |ssh| forwards.each do |f| env[:ui].info "Adding remote forward for #{f.remoteport} forwarding to #{f.host}:#{f.port}" ssh.forward.remote f.port, f.host, f.remoteport end end end @app.call env end |