Sha256: 306724fb12145efc56c6741f0e6803396ea522bf33affb077139c73adff671fc

Contents?: true

Size: 975 Bytes

Versions: 18

Compression:

Stored size: 975 Bytes

Contents

require_relative 'module'

module Trainer
  class JunitGenerator
    attr_accessor :results

    def initialize(results)
      self.results = results
    end

    def generate
      # JUnit file documentation: http://llg.cubic.org/docs/junit/
      # And http://nelsonwells.net/2012/09/how-jenkins-ci-parses-and-displays-junit-output/
      # And http://windyroad.com.au/dl/Open%20Source/JUnit.xsd

      lib_path = Trainer::ROOT
      xml_path = File.join(lib_path, "lib/assets/junit.xml.erb")
      xml = ERB.new(File.read(xml_path), trim_mode: '<>').result(binding) # http://www.rrn.dk/rubys-erb-templating-system

      xml = xml.gsub('system_', 'system-').delete("\e") # Jenkins can not parse 'ESC' symbol

      # We have to manually clear empty lines
      # They may contain white spaces
      clean_xml = []
      xml.each_line do |row|
        clean_xml << row.delete("\n") if row.strip.to_s.length > 0
      end
      return clean_xml.join("\n")
    end
  end
end

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
fastlane-security-patched-2.216.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.217.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.216.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.215.1 trainer/lib/trainer/junit_generator.rb
fastlane-2.215.0 trainer/lib/trainer/junit_generator.rb
fastlane-mercafacil-2.214.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.214.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.213.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.212.2 trainer/lib/trainer/junit_generator.rb
fastlane_pricing_fix-2.212.1 trainer/lib/trainer/junit_generator.rb
fastlane-2.212.1 trainer/lib/trainer/junit_generator.rb
fastlane-2.212.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.211.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.210.1 trainer/lib/trainer/junit_generator.rb
fastlane-2.210.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.209.1 trainer/lib/trainer/junit_generator.rb
fastlane-2.209.0 trainer/lib/trainer/junit_generator.rb
fastlane-2.208.0 trainer/lib/trainer/junit_generator.rb