Class: RSpec::Parallel::Parser
- Inherits:
-
Core::Parser
- Object
- Core::Parser
- RSpec::Parallel::Parser
- Defined in:
- lib/rspec/parallel/option_parser.rb
Instance Method Summary collapse
Instance Method Details
#parse!(args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec/parallel/option_parser.rb', line 4 def parse!(args) return {} if args.empty? convert_deprecated_args(args) = args.delete('--tty') ? {:tty => true} : {} begin parser().parse(args) delete_next = false args.delete_if do |arg| if delete_next true elsif arg == '--parallel-test' delete_next = true true end end parser(, true).parse!(args) rescue OptionParser::InvalidOption => e abort "#{e.}\n\nPlease use --help for a listing of valid options" end end |
#parser(options, bypass = false) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rspec/parallel/option_parser.rb', line 29 def parser(, bypass = false) if bypass super() else OptionParser.new do |parser| parser. = "\n **** Parallel Testing ****\n\n" parser.on('--parallel-test NUMBER', Integer, 'Run the tests with the specified number of parallel threads (default: 1).') do |n| puts "found --parallel-test with value of: #{n}" [:thread_maximum] = n || 1 end parser.on('-v', '--version', 'Display the version.') do puts "rspec-parallel: #{RSpec::Parallel::Version::STRING}" end parser.on_tail('-h', '--help', "You're looking at it.") do puts parser end end end end |