Class: CucumberStatistics::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber_statistics/configuration.rb

Class Method Summary collapse

Class Method Details

.clean_tmp_dirObject



10
11
12
# File 'lib/cucumber_statistics/configuration.rb', line 10

def clean_tmp_dir
  FileUtils.rm_r tmp_dir
end

.resolve_path_from_root(relative_path) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/cucumber_statistics/configuration.rb', line 29

def resolve_path_from_root(relative_path)
  if defined?(Rails)
    Rails.root.join(relative_path)
  elsif defined?(Rake.original_dir)
    File.expand_path(relative_path, Rake.original_dir)
  else
    File.expand_path(relative_path, Dir.pwd)
  end
end

.result_combined_statisticsObject



25
26
27
# File 'lib/cucumber_statistics/configuration.rb', line 25

def result_combined_statistics
  tmp_file('combined_statistics.html')
end

.tmp_dirObject



14
15
16
17
18
19
# File 'lib/cucumber_statistics/configuration.rb', line 14

def tmp_dir
  dir = resolve_path_from_root $tmp_path
  FileUtils.mkdir_p dir unless File.exists? dir

  dir
end

.tmp_file(filename) ⇒ Object



21
22
23
# File 'lib/cucumber_statistics/configuration.rb', line 21

def tmp_file(filename)
  "#{tmp_dir}/#{filename}"
end