Class: RSpec::MultiprocessRunner::CommandLineOptions
- Inherits:
-
Object
- Object
- RSpec::MultiprocessRunner::CommandLineOptions
- Defined in:
- lib/rspec/multiprocess_runner/command_line_options.rb
Instance Attribute Summary collapse
-
#example_timeout_seconds ⇒ Object
Returns the value of attribute example_timeout_seconds.
-
#explicit_files_or_directories ⇒ Object
Returns the value of attribute explicit_files_or_directories.
-
#file_timeout_seconds ⇒ Object
Returns the value of attribute file_timeout_seconds.
-
#log_failing_files ⇒ Object
Returns the value of attribute log_failing_files.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#rspec_options ⇒ Object
Returns the value of attribute rspec_options.
-
#worker_count ⇒ Object
Returns the value of attribute worker_count.
Instance Method Summary collapse
- #files_to_run ⇒ Object
-
#initialize ⇒ CommandLineOptions
constructor
A new instance of CommandLineOptions.
- #parse(command_line_args, error_stream = $stderr) ⇒ Object
Constructor Details
#initialize ⇒ CommandLineOptions
Returns a new instance of CommandLineOptions.
11 12 13 14 15 16 17 18 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 11 def initialize self.worker_count = 3 self.file_timeout_seconds = nil self.example_timeout_seconds = 15 self.pattern = "**/*_spec.rb" self.log_failing_files = nil self. = [] end |
Instance Attribute Details
#example_timeout_seconds ⇒ Object
Returns the value of attribute example_timeout_seconds.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def example_timeout_seconds @example_timeout_seconds end |
#explicit_files_or_directories ⇒ Object
Returns the value of attribute explicit_files_or_directories.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def explicit_files_or_directories @explicit_files_or_directories end |
#file_timeout_seconds ⇒ Object
Returns the value of attribute file_timeout_seconds.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def file_timeout_seconds @file_timeout_seconds end |
#log_failing_files ⇒ Object
Returns the value of attribute log_failing_files.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def log_failing_files @log_failing_files end |
#pattern ⇒ Object
Returns the value of attribute pattern.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def pattern @pattern end |
#rspec_options ⇒ Object
Returns the value of attribute rspec_options.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def @rspec_options end |
#worker_count ⇒ Object
Returns the value of attribute worker_count.
8 9 10 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 8 def worker_count @worker_count end |
Instance Method Details
#files_to_run ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 41 def files_to_run self.explicit_files_or_directories = %w(.) unless explicit_files_or_directories relative_root = Pathname.new('.') explicit_files_or_directories.map { |path| Pathname.new(path) }.flat_map do |path| if path.file? path.to_s else Dir[path.join(pattern).relative_path_from(relative_root)] end end.sort_by { |path| path.downcase } end |
#parse(command_line_args, error_stream = $stderr) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 20 def parse(command_line_args, error_stream=$stderr) args = command_line_args.dup parser = build_parser begin parser.parse!(args) rescue OptionParser::ParseError => e error_stream.puts e.to_s error_stream.puts parser return nil end if help_requested? error_stream.puts parser return nil end (args) self end |