Class: NoradServerspecRunner::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/norad_serverspec_runner/cli.rb

Overview

Drives the CLI for norad_serverspec_runner

Instance Method Summary collapse

Instance Method Details

#localObject



42
43
44
45
# File 'lib/norad_serverspec_runner/cli.rb', line 42

def local
  spectask = NoradServerspecRunner::Task.new(options[:tests], options[:results_file])
  spectask.run
end

#remote(encoded_key) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/norad_serverspec_runner/cli.rb', line 21

def remote(encoded_key)
  spectask = NoradServerspecRunner::Task.new(options[:tests], options[:sub_tests], options[:results_file])

  spectask.host = options[:host]
  spectask.username = options[:username]
  spectask.ssh_port = options[:port]
  # Decode the key and store
  File.open(options[:sshkey], "w") do |f|
    f.write Base64.decode64(encoded_key)
  end
  spectask.sshkey = options[:sshkey]
  spectask.run
end