Class: RSpec::MultiprocessRunner::CommandLineOptions
- Inherits:
-
Object
- Object
- RSpec::MultiprocessRunner::CommandLineOptions
- Defined in:
- lib/rspec/multiprocess_runner/command_line_options.rb
Constant Summary collapse
- DEFAULT_WORKER_COUNT =
3
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.
-
#first_is_1 ⇒ Object
Returns the value of attribute first_is_1.
-
#head_node ⇒ Object
Returns the value of attribute head_node.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#log_failing_files ⇒ Object
Returns the value of attribute log_failing_files.
-
#max_nodes ⇒ Object
Returns the value of attribute max_nodes.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#port ⇒ Object
Returns the value of attribute port.
-
#rspec_options ⇒ Object
Returns the value of attribute rspec_options.
-
#run_identifier ⇒ Object
Returns the value of attribute run_identifier.
-
#summary_filename ⇒ Object
Returns the value of attribute summary_filename.
-
#use_given_order ⇒ Object
Returns the value of attribute use_given_order.
-
#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.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 14 def initialize self.worker_count = default_worker_count self.file_timeout_seconds = nil self.example_timeout_seconds = 15 self.pattern = "**/*_spec.rb" self.log_failing_files = nil self. = [] self.first_is_1 = default_first_is_1 self.use_given_order = false self.port = 2222 self.hostname = "localhost" self.head_node = true self.max_nodes = 5 self.summary_filename = ENV['SUMMARY_FILE'] end |
Instance Attribute Details
#example_timeout_seconds ⇒ Object
Returns the value of attribute example_timeout_seconds.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def example_timeout_seconds @example_timeout_seconds end |
#explicit_files_or_directories ⇒ Object
Returns the value of attribute explicit_files_or_directories.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def explicit_files_or_directories @explicit_files_or_directories end |
#file_timeout_seconds ⇒ Object
Returns the value of attribute file_timeout_seconds.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def file_timeout_seconds @file_timeout_seconds end |
#first_is_1 ⇒ Object
Returns the value of attribute first_is_1.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def first_is_1 @first_is_1 end |
#head_node ⇒ Object
Returns the value of attribute head_node.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def head_node @head_node end |
#hostname ⇒ Object
Returns the value of attribute hostname.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def hostname @hostname end |
#log_failing_files ⇒ Object
Returns the value of attribute log_failing_files.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def log_failing_files @log_failing_files end |
#max_nodes ⇒ Object
Returns the value of attribute max_nodes.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def max_nodes @max_nodes end |
#pattern ⇒ Object
Returns the value of attribute pattern.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def pattern @pattern end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def port @port end |
#rspec_options ⇒ Object
Returns the value of attribute rspec_options.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def @rspec_options end |
#run_identifier ⇒ Object
Returns the value of attribute run_identifier.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def run_identifier @run_identifier end |
#summary_filename ⇒ Object
Returns the value of attribute summary_filename.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def summary_filename @summary_filename end |
#use_given_order ⇒ Object
Returns the value of attribute use_given_order.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def use_given_order @use_given_order end |
#worker_count ⇒ Object
Returns the value of attribute worker_count.
7 8 9 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 7 def worker_count @worker_count end |
Instance Method Details
#files_to_run ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 51 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 end |
#parse(command_line_args, error_stream = $stderr) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rspec/multiprocess_runner/command_line_options.rb', line 30 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 |