Module: SSHKit::Interactive::DSL

Defined in:
lib/sshkit/interactive/dsl.rb

Instance Method Summary collapse

Instance Method Details

#on(*args) ⇒ Object



16
17
18
19
20
# File 'lib/sshkit/interactive/dsl.rb', line 16

def on(*args)
  raise SSHKit::Interactive::Unsupported, 'Switching host in interactive mode is not possible' if Thread.current[:run_interactively]

  super
end

#run_interactively(host, options = {}, &block) ⇒ Object

run commands interactively



5
6
7
8
9
10
11
12
13
14
# File 'lib/sshkit/interactive/dsl.rb', line 5

def run_interactively(host, options = {}, &block)
  # Force setting global netssh_options on host if using capistrano
  SSHKit.config.backend.new(host) { test(:true) }.run

  Thread.current[:run_interactively] = true

  SSHKit::Interactive::Backend.new(host, options, &block).run
ensure
  Thread.current[:run_interactively] = false
end