Module: Bard::SSH
- Defined in:
- lib/bard/plugins/ssh/copy.rb,
lib/bard/plugins/ssh/connection.rb
Defined Under Namespace
Classes: Copy
Instance Method Summary collapse
- #env ⇒ Object
- #exec!(command, home: false) ⇒ Object
- #gateway ⇒ Object
- #rsync_uri(file_path = nil) ⇒ Object
- #run(command, home: false, verbose: false, quiet: false) ⇒ Object
- #run!(command, home: false, verbose: false, quiet: false, capture: false) ⇒ Object
- #scp_uri(file_path = nil) ⇒ Object
- #server ⇒ Object
- #ssh_key ⇒ Object
- #ssh_uri ⇒ Object
Instance Method Details
#env ⇒ Object
20 21 22 |
# File 'lib/bard/plugins/ssh/connection.rb', line 20 def env server.env end |
#exec!(command, home: false) ⇒ Object
51 52 53 |
# File 'lib/bard/plugins/ssh/connection.rb', line 51 def exec!(command, home: false) Command.exec!(ssh_command(command, home:)) end |
#gateway ⇒ Object
12 13 14 |
# File 'lib/bard/plugins/ssh/connection.rb', line 12 def gateway server.gateway end |
#rsync_uri(file_path = nil) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/bard/plugins/ssh/connection.rb', line 34 def rsync_uri(file_path = nil) uri = ssh_uri str = "#{uri.user}@#{uri.host}" str += ":#{path}" str += "/#{file_path}" if file_path str end |
#run(command, home: false, verbose: false, quiet: false) ⇒ Object
47 48 49 |
# File 'lib/bard/plugins/ssh/connection.rb', line 47 def run(command, home: false, verbose: false, quiet: false) Command.run(ssh_command(command, home:), verbose:, quiet:) end |
#run!(command, home: false, verbose: false, quiet: false, capture: false) ⇒ Object
42 43 44 45 |
# File 'lib/bard/plugins/ssh/connection.rb', line 42 def run!(command, home: false, verbose: false, quiet: false, capture: false) result = Command.run!(ssh_command(command, home:), verbose:, quiet:) result if capture end |
#scp_uri(file_path = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/bard/plugins/ssh/connection.rb', line 28 def scp_uri(file_path = nil) full_path = "/#{path}" full_path += "/#{file_path}" if file_path URI::Generic.build(scheme: "scp", userinfo: server.user, host: server.host, port: server.port.to_i, path: full_path) end |
#server ⇒ Object
8 9 10 |
# File 'lib/bard/plugins/ssh/connection.rb', line 8 def server @server end |
#ssh_key ⇒ Object
16 17 18 |
# File 'lib/bard/plugins/ssh/connection.rb', line 16 def ssh_key server.ssh_key end |
#ssh_uri ⇒ Object
24 25 26 |
# File 'lib/bard/plugins/ssh/connection.rb', line 24 def ssh_uri server.ssh_uri end |