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


79
80
81
82
83
84
85
86
87
88
89
90
# File 'app/presenters/ci/build_runner_presenter.rb', line 79

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


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'app/presenters/ci/build_runner_presenter.rb', line 92

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