Class: Ci::BuildRunnerPresenter::BuildArtifact

Inherits:
Struct
  • Object
show all
Defined in:
app/presenters/ci/build_runner_presenter.rb

Class Method Summary collapse

Class Method Details

.for_archive(artifacts) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
# File 'app/presenters/ci/build_runner_presenter.rb', line 91

def self.for_archive(artifacts)
  self.new(
    artifact_type: :archive,
    artifact_format: :zip,
    name: artifacts[:name],
    untracked: artifacts[:untracked],
    paths: artifacts[:paths],
    when: artifacts[:when],
    expire_in: artifacts[:expire_in],
    exclude: artifacts[:exclude]
  )
end

.for_report(report, expire_in) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'app/presenters/ci/build_runner_presenter.rb', line 104

def self.for_report(report, expire_in)
  type, params = report

  if type == :coverage_report
    artifact_type = params[:coverage_format].to_sym
    paths = [params[:path]]
  else
    artifact_type = type
    paths = params
  end

  self.new(
    artifact_type: artifact_type,
    artifact_format: ::Ci::JobArtifact::TYPE_AND_FORMAT_PAIRS.fetch(artifact_type),
    name: ::Ci::JobArtifact::DEFAULT_FILE_NAMES.fetch(artifact_type),
    paths: paths,
    when: 'always',
    expire_in: expire_in
  )
end