Class: Highway::Runtime::Report

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

Overview

This class represents a report of running a step during runtime. It contains metrics (such as status and duration) as well as metadata set by steps themselves.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invocation:, artifacts_dir:) ⇒ Report

Initialize an instance.

Parameters:



18
19
20
21
22
# File 'lib/highway/runtime/report.rb', line 18

def initialize(invocation:, artifacts_dir:)
  @invocation = invocation
  @artifacts_dir = artifacts_dir
  @data = Hash.new()
end

Instance Attribute Details

#dataHash (readonly)

The custom data in the report.

Returns:

  • (Hash)


47
48
49
# File 'lib/highway/runtime/report.rb', line 47

def data
  @data
end

#durationNumeric

Duration of the step, in seconds.

Returns:

  • (Numeric)


42
43
44
# File 'lib/highway/runtime/report.rb', line 42

def duration
  @duration
end

#errorFastlaneCore::Interface::FastlaneException?

An error that the step failed with, if any.

Returns:

  • (FastlaneCore::Interface::FastlaneException, nil)


37
38
39
# File 'lib/highway/runtime/report.rb', line 37

def error
  @error
end

#invocationHighway::Compiler::Build::Output::Invocation

The invocation.



27
28
29
# File 'lib/highway/runtime/report.rb', line 27

def invocation
  @invocation
end

#resultSymbol

Result of the step, one of: ‘:success`, `:failure`, `:skip`.

Returns:

  • (Symbol)


32
33
34
# File 'lib/highway/runtime/report.rb', line 32

def result
  @result
end

Instance Method Details

#[](key) ⇒ Object?

Get custom data value for given key.

Parameters:

  • key (String)

    A key.

Returns:

  • (Object, nil)


54
55
56
# File 'lib/highway/runtime/report.rb', line 54

def [](key)
  @data[key]
end

#[]=(key, value) ⇒ Void

Set custom data value for given key.

Parameters:

  • key (String)

    A key.

  • value (Object, nil)

    A value.

Returns:

  • (Void)


64
65
66
# File 'lib/highway/runtime/report.rb', line 64

def []=(key, value)
  @data[key] = value
end

#prepare_artifact(name) ⇒ String

Prepare an artifact file with a given name and return its path.

Parameters:

  • name (String)

    An artifact file name.

Returns:

  • (String)


73
74
75
# File 'lib/highway/runtime/report.rb', line 73

def prepare_artifact(name)
  File.join(@artifacts_dir, "#{invocation.identifier}-#{name}")
end