Method: Spec::Runner::OptionParser#initialize

Defined in:
lib/spec/runner/option_parser.rb

#initialize(err, out) ⇒ OptionParser

Returns a new instance of OptionParser.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/spec/runner/option_parser.rb', line 88

def initialize(err, out)
  super()
  @error_stream = err
  @out_stream = out
  @options = Options.new(@error_stream, @out_stream)

  @file_factory = File

  self.banner = "Usage: spec (FILE(:LINE)?|DIRECTORY|GLOB)+ [options]"
  self.separator ""
  on(*OPTIONS[:pattern])          {|pattern| @options.filename_pattern = pattern}
  on(*OPTIONS[:diff])             {|diff| @options.parse_diff(diff)}
  on(*OPTIONS[:colour])           {@options.colour = true}
  on(*OPTIONS[:example])          {|example| @options.parse_example(example)}
  on(*OPTIONS[:specification])    {|example| @options.parse_example(example)}
  on(*OPTIONS[:line])             {|line_number| @options.line_number = line_number.to_i}
  on(*OPTIONS[:format])           {|format| @options.parse_format(format)}
  on(*OPTIONS[:require])          {|requires| invoke_requires(requires)}
  on(*OPTIONS[:backtrace])        {@options.backtrace_tweaker = NoisyBacktraceTweaker.new}
  on(*OPTIONS[:loadby])           {|loadby| @options.loadby = loadby}
  on(*OPTIONS[:reverse])          {@options.reverse = true}
  on(*OPTIONS[:timeout])          {|timeout| @options.timeout = timeout.to_f}
  on(*OPTIONS[:heckle])           {|heckle| @options.load_heckle_runner(heckle)}
  on(*OPTIONS[:dry_run])          {@options.dry_run = true}
  on(*OPTIONS[:options_file])     {|options_file|}
  on(*OPTIONS[:generate_options]) {|options_file|}
  on(*OPTIONS[:runner])           {|runner|  @options.user_input_for_runner = runner}
  on(*OPTIONS[:debug])            {@options.debug = true}
  on(*OPTIONS[:drb])              {}
  on(*OPTIONS[:drb_port])         {|port| @options.drb_port = port}
  on(*OPTIONS[:version])          {parse_version}
  on("--autospec")                {@options.autospec = true}
  on_tail(*OPTIONS[:help])        {parse_help}
end