class TestChanges::ARGVWrapper

Attributes

argv[R]

Public Class Methods

new(argv) click to toggle source
# File lib/test_changes/argv_wrapper.rb, line 5
def initialize(argv)
  @argv = argv
end

Public Instance Methods

commit() click to toggle source
# File lib/test_changes/argv_wrapper.rb, line 9
def commit
  slop_options[:commit]
end
runner_call_options() click to toggle source
# File lib/test_changes/argv_wrapper.rb, line 13
def runner_call_options
  runner_call_options_delimiter_index = argv.index('--')

  if runner_call_options_delimiter_index
    argv.slice(runner_call_options_delimiter_index + 1, argv.size)
  else
    []
  end
end
runner_name() click to toggle source
# File lib/test_changes/argv_wrapper.rb, line 23
def runner_name
  slop_options[:runner]
end
verbose?() click to toggle source
# File lib/test_changes/argv_wrapper.rb, line 27
def verbose?
  !slop_options.quiet?
end

Private Instance Methods

banner() click to toggle source

rubocop:enable Metrics/MethodLength

slop_options() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/test_changes/argv_wrapper.rb, line 34
def slop_options
  Slop.parse(argv) do |o|
    o.banner = banner
    o.string '-c', '--commit', 'Git commit. Default: HEAD.', default: 'HEAD'
    o.boolean '-q', '--quiet', 'Do not print output. Default: false.', default: false

    o.string '-r', '--runner',
      'The test tool to run. Default: the first runner of the config file.'

    o.on '-h', '--help', 'Display this help message.' do
      puts o
      exit
    end

    o.on '-v', '--version', 'Display the version.' do
      puts VERSION
      exit
    end
  end
end