Module: Escualo::Script

Defined in:
lib/escualo/script.rb

Class Method Summary collapse

Class Method Details

.commands(escualo, script, extra) ⇒ Object



3
4
5
# File 'lib/escualo/script.rb', line 3

def self.commands(escualo, script, extra)
  (script||[]).map { |it| "#{escualo} #{it} #{extra}" }
end

.delegated_options(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/escualo/script.rb', line 7

def self.delegated_options(options)
  [options.hostname.try { |it| "--hostname #{it}" },
   options.username.try { |it| "--username #{it}" },
   options.password.try { |it| "--ssh-password #{it}" },
   options.ssh_key.try { |it| "--ssh-key #{it}" },
   options.ssh_port.try { |it| "--ssh-port #{it}" },
   options.trace && '--trace',
   options.verbose && '--verbose',
  ].compact.join(' ')
end

.run!(session, escualo, script, extra = '') ⇒ Object



18
19
20
21
22
# File 'lib/escualo/script.rb', line 18

def self.run!(session, escualo, script, extra='')
  Escualo::Script.commands(escualo, script, extra).each do |command|
    session.embed! command
  end
end