Class: Shell
- Inherits:
-
Object
- Object
- Shell
- Defined in:
- lib/rstuk.rb
Class Method Summary collapse
- .local(cmd, expected_exit_status = 0) ⇒ Object
- .remote(server, port, cmd, opts = {}) ⇒ Object
- .scp(source, server, port, dest) ⇒ Object
Class Method Details
.local(cmd, expected_exit_status = 0) ⇒ Object
23 24 25 26 |
# File 'lib/rstuk.rb', line 23 def self.local cmd, expected_exit_status = 0 puts "local: #{cmd}" self.do cmd, expected_exit_status end |
.remote(server, port, cmd, opts = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/rstuk.rb', line 13 def self.remote server, port, cmd, opts = {} defaults = {exit_code: 0, timeout: 90} opts = defaults.merge opts self.wait_for server, port, opts[:timeout] puts "ssh: #{cmd}" self.do \ "ssh root@#{server} #{self.} -p #{port} \"#{cmd}\"", opts[:exit_code] end |
.scp(source, server, port, dest) ⇒ Object
28 29 30 31 |
# File 'lib/rstuk.rb', line 28 def self.scp source, server, port, dest puts "scp: #{source} root@#{server}:#{dest}" self.do "scp #{self.} -r -P #{port} #{source} root@#{server}:#{dest}", 0 end |