Module: Rdm::SpecRunner
- Defined in:
- lib/rdm/spec_runner.rb
Defined Under Namespace
Classes: CommandGenerator, CommandParams, PackageFetcher, Runner, SpecFilenameMatcher, View
Class Method Summary collapse
Class Method Details
.run(path: nil, package: nil, spec_matcher: nil, show_missing_packages: true, skip_ignored_packages: false, stdout: STDOUT, stdin: STDIN, show_output: true) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 43 44 45 46 47 48 49 50 |
# File 'lib/rdm/spec_runner.rb', line 2 def self.run( path: nil, package: nil, spec_matcher: nil, show_missing_packages: true, skip_ignored_packages: false, stdout: STDOUT, stdin: STDIN, show_output: true ) Rdm::SpecRunner::Runner.new( path: path, package: package, spec_matcher: spec_matcher, show_missing_packages: show_missing_packages, skip_ignored_packages: skip_ignored_packages, show_output: show_output, stdout: stdout ).run rescue Rdm::Errors::SpecMatcherNoFiles => e stdout.puts e. rescue Rdm::Errors::SpecMatcherMultipleFiles => e spec_files = e..split("\n") format_spec_files = spec_files.map.with_index {|file, idx| "#{idx+1}. #{file}"}.join("\n") stdout.puts "Following specs match your input:" stdout.puts format_spec_files stdout.print "Enter space-separated file numbers, ex: '1 2': " selected_files_numbers = stdin.gets.chomp .split(' ') .map {|x| Integer(x) rescue nil } .compact .map {|n| n - 1} .reject {|n| n >= spec_files.size} spec_files .select .with_index {|_file, idx| selected_files_numbers.include?(idx)} .each do |file| Rdm::SpecRunner::Runner.new( path: path, package: package, spec_matcher: file, show_missing_packages: show_missing_packages, skip_ignored_packages: skip_ignored_packages ).run end end |