Class: Escualo::Session::Local

Inherits:
Escualo::Session show all
Defined in:
lib/escualo/session/local_session.rb

Instance Attribute Summary

Attributes inherited from Escualo::Session

#options

Instance Method Summary collapse

Methods inherited from Escualo::Session

#check?, #clean_environment_variables!, #initialize, parse_session_options, set_command, #set_environment_variables!, #setup_environment_variables!, #tell!, #tell_all!, #unset_environment_variables!, #upload_template!, within, within_dockerized_session, within_ssh_session, #write_template!

Constructor Details

This class inherits a constructor from Escualo::Session

Instance Method Details

#ask(command) ⇒ Object



7
8
9
# File 'lib/escualo/session/local_session.rb', line 7

def ask(command)
  Open3.exec! command
end

#exec!(command) ⇒ Object



2
3
4
5
# File 'lib/escualo/session/local_session.rb', line 2

def exec!(command)
  ask command
  nil
end

#stream!(command) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/escualo/session/local_session.rb', line 11

def stream!(command)
  Open3.popen2e command do |_input, output, wait|
    output.each do |line|
      $stdout.print line
    end
    raise "command #{command} failed" unless wait.value.success?
  end
end

#upload!(file, destination) ⇒ Object



20
21
22
# File 'lib/escualo/session/local_session.rb', line 20

def upload!(file, destination)
  FileUtils.cp file, destination
end