Class: SSHKit::Backend::Abstract

Inherits:
Object
  • Object
show all
Includes:
CommandEnvMerge, TimedCommands
Defined in:
lib/dash/sshkit_with_ext.rb

Defined Under Namespace

Modules: CommandEnvMerge, TimedCommands

Instance Method Summary collapse

Instance Method Details

#capture_with_debug(*args, **kwargs) ⇒ Object



35
36
37
# File 'lib/dash/sshkit_with_ext.rb', line 35

def capture_with_debug(*args, **kwargs)
  capture(*args, **kwargs, verbosity: Logger::DEBUG)
end

#capture_with_info(*args, **kwargs) ⇒ Object



31
32
33
# File 'lib/dash/sshkit_with_ext.rb', line 31

def capture_with_info(*args, **kwargs)
  capture(*args, **kwargs, verbosity: Logger::INFO)
end

#capture_with_pretty_json(*args, **kwargs) ⇒ Object



39
40
41
# File 'lib/dash/sshkit_with_ext.rb', line 39

def capture_with_pretty_json(*args, **kwargs)
  JSON.pretty_generate(JSON.parse(capture(*args, **kwargs)))
end

#puts_by_host(host, output, type: "App", quiet: false, raw: false) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/dash/sshkit_with_ext.rb', line 43

def puts_by_host(host, output, type: "App", quiet: false, raw: false)
  if raw
    $stdout.binmode
    $stdout.write(output)
  else
    unless quiet
      puts "#{type} Host: #{host}"
    end
    puts "#{output}\n\n"
  end
end