Class: SauceTest::Runner::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/sauce-test/runner/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt_array = ARGV) ⇒ Options

Returns a new instance of Options.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/sauce-test/runner/options.rb', line 18

def initialize(opt_array = ARGV)
  @browser = {}

  @opt_parser = OptionParser.new

  @opt_parser.banner = "Usage: sauce_test [options] FILE"

  @opt_parser.on(*OPTIONS[:list])       {|list| @list = true}
  @opt_parser.on(*OPTIONS[:type])       {|type| parse_type type}
  @opt_parser.on(*OPTIONS[:example])    {|example| @example = example}
  @opt_parser.on(*OPTIONS[:report])     {|report| @report_file = File.expand_path report}
  @opt_parser.on(*OPTIONS[:browser])    {|browser| @browser['name'] = browser}
  @opt_parser.on(*OPTIONS[:version])    {|version| @browser['version'] = version}
  @opt_parser.on(*OPTIONS[:os])         {|os| @browser['os'] = os}
  @opt_parser.on(*OPTIONS[:config])     {|config| parse_config(config)}
  @opt_parser.on(*OPTIONS[:help])       {show_help}

  @opt_parser.separator EXAMPLES

  opt_rest = @opt_parser.parse(opt_array)

  create_sauce_options unless list

  parse_test_file(opt_rest[0])
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def example
  @example
end

#listObject (readonly)

Returns the value of attribute list.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def list
  @list
end

#report_fileObject (readonly)

Returns the value of attribute report_file.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def report_file
  @report_file
end

#sauce_optionsObject (readonly)

Returns the value of attribute sauce_options.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def sauce_options
  @sauce_options
end

#test_fileObject (readonly)

Returns the value of attribute test_file.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def test_file
  @test_file
end

#test_typeObject (readonly)

Returns the value of attribute test_type.



11
12
13
# File 'lib/sauce-test/runner/options.rb', line 11

def test_type
  @test_type
end