Method: #result_directory

Defined in:
lib/tddium/reporting.rb

#result_directoryObject

Prepare the result directory, as specified by config.

If the directory doesn’t exist create it, and a latest subdirectory.

If the latest subdirectory exists, rotate it and create a new empty latest.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tddium/reporting.rb', line 11

def result_directory
  conf = read_config
  latest = File.join(conf[:result_directory], 'latest')

  if File.directory?(latest) then
    mtime = File.stat(latest).mtime.strftime("%Y%m%d-%H%M%S")
    archive = File.join(conf[:result_directory], mtime)
    FileUtils.mv(latest, archive)
  end
  FileUtils.mkdir_p latest
  latest
end