Class: KnapsackPro::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack_pro/report.rb

Class Method Summary collapse

Class Method Details

.saveObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/knapsack_pro/report.rb', line 3

def self.save
  repository_adapter = KnapsackPro::RepositoryAdapterInitiator.call
  action = KnapsackPro::Client::API::V1::BuildSubsets.create(
    commit_hash: repository_adapter.commit_hash,
    branch: repository_adapter.branch,
    node_total: KnapsackPro::Config::Env.ci_node_total,
    node_index: KnapsackPro::Config::Env.ci_node_index,
    test_files: KnapsackPro.tracker.to_a,
  )
  connection = KnapsackPro::Client::Connection.new(action)
  response = connection.call
  if connection.success?
    raise ArgumentError.new(response) if connection.errors?
    KnapsackPro.logger.info('Saved time execution report on API server.')
  end
end