Class: CovhuraClient
- Inherits:
-
Object
- Object
- CovhuraClient
- Defined in:
- lib/integrations/covhura_client.rb
Constant Summary collapse
- ROOT_PATH =
Dir.pwd
Instance Method Summary collapse
- #get_report(commit_id, app_files) ⇒ Object
-
#initialize(config) ⇒ CovhuraClient
constructor
A new instance of CovhuraClient.
Constructor Details
#initialize(config) ⇒ CovhuraClient
Returns a new instance of CovhuraClient.
8 9 |
# File 'lib/integrations/covhura_client.rb', line 8 def initialize(config) end |
Instance Method Details
#get_report(commit_id, app_files) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/integrations/covhura_client.rb', line 11 def get_report(commit_id, app_files) filename = File.join(Dir.pwd, ".gitolemy", "coverage", "#{commit_id}.covhura.json.gz") return {} if not File.exist?(filename) coverage = JSON.parse(Zlib::GzipReader.open(filename) { |gz| gz.read }) root_path = coverage_root_path(coverage.keys, app_files) coverage.reduce({}) do |acc, (file_path, file_coverage)| begin acc[file_path.sub(root_path, "")] = file_coverage acc rescue => e byebug 1 end end end |