Sha256: 1317e3843c4e0f4d1d2394d59acb1c5849e44f7fdfd0a85250594c280b7bbfaf

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 Bytes

Contents

require 'fitting/rep/html'

module Fitting
  class Rep
    def initialize(apis)
      @actions = apis
    end

    def save!
      destination = 'coverage'
      FileUtils.mkdir_p(destination)

      fitting_json = @actions.inject({}) do |sum, action|
        sum.merge(action.to_hash)
      end
      fitting_lock_json = @actions.inject({}) do |sum, action|
        sum.merge(action.to_hash_lock)
      end
      File.open('coverage/.fitting.json', 'w') { |file| file.write(::JSON.pretty_generate(fitting_json)) }
      File.open('coverage/.fitting.lock.json', 'w') { |file| file.write(::JSON.pretty_generate(fitting_lock_json)) }
      Fitting::Rep::HTML.bootstrap('coverage', fitting_json, fitting_lock_json)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fitting-4.2.1 lib/fitting/rep.rb
fitting-4.2.0 lib/fitting/rep.rb
fitting-4.1.0 lib/fitting/rep.rb
fitting-4.0.4 lib/fitting/rep.rb
fitting-4.0.3 lib/fitting/rep.rb
fitting-4.0.2 lib/fitting/rep.rb
fitting-4.0.1 lib/fitting/rep.rb
fitting-4.0.0 lib/fitting/rep.rb