Method: Cucumber::Formatter::Io#ensure_dir

Defined in:
lib/cucumber/formatter/io.rb

#ensure_dir(path, name) ⇒ Object



25
26
27
28
29
30
# File 'lib/cucumber/formatter/io.rb', line 25

def ensure_dir(path, name)
  raise "You *must* specify --out DIR for the #{name} formatter" unless String === path
  raise "I can't write #{name} reports to a file - it has to be a directory" if File.file?(path)
  FileUtils.mkdir_p(path) unless File.directory?(path)
  path
end