Class: Specinfra::Backend::Ssh
- Defined in:
- lib/specinfra/backend/ssh.rb
Instance Method Summary collapse
- #build_command(cmd) ⇒ Object
- #run_command(cmd, opt = {}) ⇒ Object
- #send_directory(from, to) ⇒ Object
- #send_file(from, to) ⇒ Object
Methods inherited from Base
Instance Method Details
#build_command(cmd) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/specinfra/backend/ssh.rb', line 34 def build_command(cmd) cmd = super(cmd) if sudo? cmd = "#{sudo} -p '#{prompt}' #{cmd}" end cmd end |
#run_command(cmd, opt = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/specinfra/backend/ssh.rb', line 8 def run_command(cmd, opt={}) cmd = build_command(cmd) cmd = add_pre_command(cmd) ret = with_env do ssh_exec!(cmd) end ret[:stdout].gsub!(/\r\n/, "\n") ret[:stdout].gsub!(/\A\n/, "") if sudo? if @example @example.[:command] = cmd @example.[:stdout] = ret[:stdout] end CommandResult.new ret end |
#send_directory(from, to) ⇒ Object
30 31 32 |
# File 'lib/specinfra/backend/ssh.rb', line 30 def send_directory(from, to) scp_upload!(from, to, :recursive => true) end |
#send_file(from, to) ⇒ Object
26 27 28 |
# File 'lib/specinfra/backend/ssh.rb', line 26 def send_file(from, to) scp_upload!(from, to) end |