Class: CucumberBoosterConfig::Injection

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber_booster_config/injection.rb

Constant Summary collapse

CUCUMBER_FILES =
[
  "cucumber.yml",
  "config/cucumber.yml"
]

Instance Method Summary collapse

Constructor Details

#initialize(path, report_path, options = {}) ⇒ Injection

Returns a new instance of Injection.



12
13
14
15
16
# File 'lib/cucumber_booster_config/injection.rb', line 12

def initialize(path, report_path, options = {})
  @path = path
  @report_path = report_path
  @dry_run = options.fetch(:dry_run, false)
end

Instance Method Details

#find_profile_filesObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cucumber_booster_config/injection.rb', line 18

def find_profile_files
  profile_files = []

  CUCUMBER_FILES.map { |file_name| cucumber_file_path(file_name) }.each do |file|
    if File.exist?(file)
      puts "Found Cucumber profile file: #{file}"
      profile_files << file
    end
  end

  profile_files
end

#runObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/cucumber_booster_config/injection.rb', line 31

def run
  if no_profile_files?
    puts "No cucumber profile files found. Creating empty cucumber.yml file"
    FileUtils.touch("cucumber.yml")
  end

  find_profile_files.each do |path|
    CucumberFile.new(path, @dry_run).configure_for_autoparallelism(@report_path)
  end
end