Class: CoverallsMulti::Formatter::Lcov

Inherits:
Object
  • Object
show all
Defined in:
lib/coveralls-multi/formatters/lcov.rb

Overview

formats lcov coverage results files before merge + push to Coveralls

Instance Method Summary collapse

Instance Method Details

#run(file_path) ⇒ Object

convert lcov files using the coveralls-lcov gem



10
11
12
13
14
15
16
17
18
19
# File 'lib/coveralls-multi/formatters/lcov.rb', line 10

def run(file_path)
  converter = Coveralls::Lcov::Converter.new(file_path)
  file = converter.convert
  # HACK: stringify keys without iterating over the whole array of hashes
  JSON.parse(JSON.dump(file[:source_files]))
rescue StandardError, SystemExit => e
  puts "[CoverallsMulti] There was a problem converting the lcov file at #{file_path}."
  puts '[CoverallsMulti] Make sure the file exists.'
  raise e
end