mirror of
https://github.com/ditkrg/simplecov-json.git
synced 2026-01-22 22:06:46 +00:00
Merge pull request #18 from kevjin/simplecov-compatibility
Make gem compatible with older versions of simplecov
This commit is contained in:
commit
c7f7ef27d2
@ -10,10 +10,14 @@ class SimpleCov::Formatter::JSONFormatter
|
|||||||
data[:files] = []
|
data[:files] = []
|
||||||
result.files.each do |sourceFile|
|
result.files.each do |sourceFile|
|
||||||
next unless result.filenames.include? sourceFile.filename
|
next unless result.filenames.include? sourceFile.filename
|
||||||
|
|
||||||
|
# Compatible with older versions of simplecov.
|
||||||
|
coverage_data = (defined? sourceFile.coverage) ? sourceFile.coverage : sourceFile.coverage_data
|
||||||
|
|
||||||
data[:files] << {
|
data[:files] << {
|
||||||
filename: sourceFile.filename,
|
filename: sourceFile.filename,
|
||||||
covered_percent: sourceFile.covered_percent,
|
covered_percent: sourceFile.covered_percent,
|
||||||
coverage: sourceFile.coverage_data,
|
coverage: coverage_data,
|
||||||
covered_strength: sourceFile.covered_strength.nan? ? 0.0 : sourceFile.covered_strength,
|
covered_strength: sourceFile.covered_strength.nan? ? 0.0 : sourceFile.covered_strength,
|
||||||
covered_lines: sourceFile.covered_lines.count,
|
covered_lines: sourceFile.covered_lines.count,
|
||||||
lines_of_code: sourceFile.lines_of_code,
|
lines_of_code: sourceFile.lines_of_code,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "simplecov-json"
|
s.name = "simplecov-json"
|
||||||
s.version = '0.2.1'
|
s.version = '0.2.2'
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.authors = ["Vicent Llongo"]
|
s.authors = ["Vicent Llongo"]
|
||||||
s.email = ["villosil@gmail.com"]
|
s.email = ["villosil@gmail.com"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user