Module: Slather::CoverageService::JsonOutput
- Defined in:
- lib/slather/coverage_service/json_output.rb
Instance Method Summary collapse
Instance Method Details
#post ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/slather/coverage_service/json_output.rb', line 17 def post report = coverage_files.map do |file| { file: file.source_file_pathname_relative_to_repo_root, coverage: file.line_coverage_data } end.to_json store_report(report) end |
#store_report(report) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/slather/coverage_service/json_output.rb', line 28 def store_report(report) output_file = 'report.json' if output_directory FileUtils.mkdir_p(output_directory) output_file = File.join(output_directory, output_file) end File.write(output_file, report.to_s) end |