Class: SSHKit::Interactive::Backend
- Inherits:
-
Backend::Printer
- Object
- Backend::Printer
- SSHKit::Interactive::Backend
- Defined in:
- lib/sshkit/interactive/backend.rb
Instance Method Summary collapse
- #_unsupported_operation(*args) ⇒ Object (also: #upload!, #download!, #test, #capture)
- #as(who, &_block) ⇒ Object
- #execute(*args) ⇒ Object
- #run ⇒ Object
- #within(directory, &_block) ⇒ Object
Instance Method Details
#_unsupported_operation(*args) ⇒ Object Also known as: upload!, download!, test, capture
44 45 46 |
# File 'lib/sshkit/interactive/backend.rb', line 44 def _unsupported_operation(*args) raise SSHKit::Backend::MethodUnavailableError, 'SSHKit::Interactive does not support this operation.' end |
#as(who, &_block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sshkit/interactive/backend.rb', line 16 def as(who, &_block) if who.is_a?(Hash) @user = who[:user] || who['user'] @group = who[:group] || who['group'] else @user = who @group = nil end raise SSHKit::Interactive::Unsupported, 'Setting group (through `as`) is currently not supported' unless @group.nil? yield ensure remove_instance_variable(:@user) remove_instance_variable(:@group) end |
#execute(*args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sshkit/interactive/backend.rb', line 33 def execute(*args) super = args. cmd = Command.new(host, command(args, )) debug(cmd.to_s) cmd.execute end |
#run ⇒ Object
4 5 6 |
# File 'lib/sshkit/interactive/backend.rb', line 4 def run instance_exec(host, &@block) end |
#within(directory, &_block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/sshkit/interactive/backend.rb', line 8 def within(directory, &_block) (@pwd ||= []).push(directory.to_s) yield ensure @pwd.pop end |