Sha256: abd769f40e046a3f608c7c3c7befc151f5d47e7e489d3b9fb65e42c953adf424

Contents?: true

Size: 1.13 KB

Versions: 24

Compression:

Stored size: 1.13 KB

Contents

module RubyCI
  module SimpleCov
    module Reporting
      def self.included base
        base.instance_eval do
          unless (ENV['RUBY_CI_SECRET_KEY'] || '').empty?
            def write_last_run(result)
              ::SimpleCov::LastRun.write(result:
                result.coverage_statistics.transform_values do |stats|
                  round_coverage(stats.percent)
                end)

              source = {}

              result.source_files.each do |source_file|
                source[source_file.filename.gsub(root, '')] = source_file.src
              end

              result_json = {}

              result.as_json.each do |command, data|
                result_json[command] = data
                data['coverage'].clone.each do |src, file_data|
                  result_json[command]['coverage'].delete(src)

                  file_data['src'] = source[src.gsub(root, '')]

                  result_json[command]['coverage'][src.gsub(root, '')] = file_data
                end
              end

              RubyCI.report_simplecov(result_json.to_json)
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ruby_ci-0.2.26 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.25 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.24 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.23 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.22 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.21 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.20 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.19 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.18 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.17 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.16 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.15 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.14 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.13 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.12 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.11 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.10 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.9 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.8 lib/ruby_ci/simple_cov/reporting.rb
ruby_ci-0.2.7 lib/ruby_ci/simple_cov/reporting.rb