Class: Ree::CLI::SpecRunner
Instance Attribute Summary collapse
-
#packages_to_run ⇒ Object
readonly
Returns the value of attribute packages_to_run.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(package_names:, spec_matcher:, tag_name:, with_children:, with_ancestors:, run_all: false, path:, stdout: STDOUT) ⇒ SpecRunner
constructor
A new instance of SpecRunner.
- #run ⇒ Object
Constructor Details
#initialize(package_names:, spec_matcher:, tag_name:, with_children:, with_ancestors:, run_all: false, path:, stdout: STDOUT) ⇒ SpecRunner
Returns a new instance of SpecRunner.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ree/cli/spec_runner.rb', line 23 def initialize(package_names:, spec_matcher:, tag_name:, with_children:, with_ancestors:, run_all: false, path:, stdout: STDOUT) @package_names = package_names || [] @packages_to_run = @package_names @spec_matcher = spec_matcher @tag_name = tag_name @with_children = with_children @with_ancestors = with_ancestors @run_all = run_all @path = path @stdout = stdout end |
Instance Attribute Details
#packages_to_run ⇒ Object (readonly)
Returns the value of attribute packages_to_run.
6 7 8 |
# File 'lib/ree/cli/spec_runner.rb', line 6 def packages_to_run @packages_to_run end |
Class Method Details
.run(path:, package_names:, spec_matcher:, tag_name:, with_children:, with_ancestors:, run_all: false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ree/cli/spec_runner.rb', line 9 def run(path:, package_names:, spec_matcher:, tag_name:, with_children:, with_ancestors:, run_all: false) SpecRunner.new( package_names: package_names, spec_matcher: spec_matcher, tag_name: tag_name, with_children: with_children, with_ancestors: with_ancestors, path: path, run_all: run_all ).run end |
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ree/cli/spec_runner.rb', line 36 def run schema_path = Ree.locate_packages_schema(@path) schema_dir = Pathname.new(schema_path).dirname.to_s Ree.init(schema_dir) unless non_existent_packages.empty? non_existent_packages.map do |pack| puts "Package #{pack} not found" @package_names.delete(pack) end end if @tag_name puts "Trying to find packages with tag \"#{@tag_name}\"..." tagged_packages = find_tagged_packages if tagged_packages.empty? puts "No packages found with tag #{@tag_name}" end @packages_to_run.push(*tagged_packages) end if @with_children children_packages = @package_names.map do |package_name| puts "Trying to find children packages for #{package_name}" find_children_packages(package_name) end @packages_to_run.push(*children_packages) end if @with_ancestors ancestors_packages = @package_names.map do |package_name| puts "Trying to find ancestors packages for #{package_name}" find_ancestors_packages(package_name) end @packages_to_run.push(*ancestors_packages) end if @run_all puts "Running specs for all packages..." @packages_to_run.push(*packages.map(&:name)) end @packages_to_run = @packages_to_run.flatten.uniq if @packages_to_run.empty? puts "No packages found with specified options" end @packages_to_run.each do |package| ree_package = Ree.container.packages_facade.get_package(package) next if ree_package.dir.nil? Ree::SpecRunner::Runner.new( path: Ree::PathHelper.project_root_dir(ree_package), package: package, spec_matcher: @spec_matcher, stdout: $stdout ).run end end |