Class: CI::Reporter::ReportManager

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/report_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ ReportManager

Returns a new instance of ReportManager.



10
11
12
13
14
# File 'lib/ci/reporter/report_manager.rb', line 10

def initialize(prefix)
  @basedir = ENV['CI_REPORTS'] || File.expand_path("#{Dir.getwd}/#{prefix.downcase}/reports")
  @basename = "#{@basedir}/#{prefix.upcase}"
  FileUtils.mkdir_p(@basedir)
end

Instance Method Details

#write_report(suite) ⇒ Object



16
17
18
19
20
# File 'lib/ci/reporter/report_manager.rb', line 16

def write_report(suite)
  File.open("#{@basename}-#{suite.name.gsub(/[^a-zA-Z0-9]+/, '-')}.xml", "w") do |f|
    f << suite.to_xml
  end
end