class ShoulderTap::CLI

Public Class Methods

new(arguments, tap_output) click to toggle source
# File lib/shouldertap/cli.rb, line 9
def initialize(arguments, tap_output)
  @arguments = arguments
  @tap_output = tap_output
end

Public Instance Methods

run() click to toggle source
# File lib/shouldertap/cli.rb, line 14
def run
  testsuite = ShoulderTap::Testsuite.new @tap_output
  ShoulderTap::Notification.new(testsuite, options[:name]).send
end

Private Instance Methods

options() click to toggle source
# File lib/shouldertap/cli.rb, line 21
def options
  @options ||= parse_options
end
parse_options() click to toggle source
# File lib/shouldertap/cli.rb, line 25
def parse_options
  options = {}
  parser = OptionParser.new do |opts|
    opts.banner = "Usage: shouldertap [-h] [-r NAME] < TAP_OUTPUT"
    opts.on '-h', '--help', 'Print help' do 
      STDERR.puts opts
      exit 1
    end
    opts.on '-n', '--name NAME', 'Name of the test that ShoulderTap will report as. Defaults to "ShoulderTap"' do |n|
      options[:name] = n
    end
  end
  parser.parse! @arguments
  options
end