Sha256: 4552a5c164d1747a7803329adafe125996909541e5a2b7f4cf2f3afb5a01b5a6

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require 'thor'
require 'norad_spec_runner/task'
require 'norad_spec_runner/remote_task'
require 'base64'
require 'openssl'

module NoradSpecRunner
  # Drives the CLI for norad_spec_runner
  class Cli < Thor
    desc 'remote encoded_key', 'Will test a server using RSpec'
    long_desc <<-SPEC_REMOTE

    `norad_spec_runner remote` will ssh into a server and run RSpec tests
    SPEC_REMOTE
    method_option :host, :aliases => '-h', :desc => 'Host to scan'
    method_option :username, :aliases => '-u', :desc => 'Username to login as'
    method_option :sshkey, :aliases => '-k', :desc => 'SSH Key to use', :default => '/tmp/sshkey'
    method_option :tests, :aliases => '-t', :desc => 'Rspec tests to execute'
    method_option :sub_tests, :aliases => '-s', :desc => 'Specific test from given RSpec file', :default => '\'\''
    method_option :results_file, :aliases => '-r', :desc => 'File to store the results'
    method_option :port, :aliases => '-p', :desc => 'Port to connect on', :default => 22
    method_option :detect_os, :desc => 'Whether or not to perform OS detection', :type => :boolean, :default => false

    def remote(encoded_key)
      spectask = NoradSpecRunner::RemoteTask.new(encoded_key, options)
      spectask.run
    end

    desc 'local', 'Will execute RSpec tests locally'
    long_desc <<-SPEC_LOCAL

    `norad_spec_runner local` will run RSpec tests locally
    SPEC_LOCAL
    method_option :tests, :aliases => '-t', :desc => 'Rspec tests to execute'
    method_option :results_file, :aliases => '-r', :desc => 'File to store the results'
    # FIXME: this class doesn't exist any more
    def local
      spectask = NoradSpecRunner::Task.new(options[:tests], options[:results_file])
      spectask.run
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
norad_spec_runner-0.3.1 lib/norad_spec_runner/cli.rb
norad_spec_runner-0.3.0 lib/norad_spec_runner/cli.rb