Module: MavenEmmaForGitLab
- Defined in:
- lib/maven_emma_for_gitlab.rb
Constant Summary collapse
- FILE_LOCATION =
'target/site/emma/coverage.xml'
Class Method Summary collapse
Class Method Details
.print_coverage ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/maven_emma_for_gitlab.rb', line 5 def self.print_coverage unless File.exists? FILE_LOCATION puts 'No coverage file found.' return end doc = Nokogiri::XML(File.open(FILE_LOCATION).read()) coverages = doc.xpath('//all/coverage') puts "Overall code coverage:" coverages.each do |coverage| output = ' ' output << coverage['type'].split(',').first.capitalize output << ': ' output << coverage['value'].split(/\s/).first puts output end end |