Class: BoringBuilder::Exporter
- Inherits:
-
Object
- Object
- BoringBuilder::Exporter
- Defined in:
- lib/boringbuilder/exporter.rb
Constant Summary collapse
- PACKER_IMAGE =
"alpine:3.22@sha256:14358309a308569c32bdc37e2e0e9694be33a9d99e68afb0f5ff33cc1f695dce"
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#exporters ⇒ Object
readonly
Returns the value of attribute exporters.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(project, client, container, runtime:, command_runner: nil, exporters: nil, progress: DaggerRuby::Progress.silent) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(project, client, container, runtime:, command_runner: nil, exporters: nil, progress: DaggerRuby::Progress.silent) ⇒ Exporter
Returns a new instance of Exporter.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/boringbuilder/exporter.rb', line 12 def initialize(project, client, container, runtime:, command_runner: nil, exporters: nil, progress: DaggerRuby::Progress.silent) @project = project @client = client @container = container @runtime = runtime @command_runner = command_runner || ->(*command) { Open3.capture3(*command) } @exporters = exporters || Exporters::Resolver.new(project, client).destinations @progress = progress end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def client @client end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def container @container end |
#exporters ⇒ Object (readonly)
Returns the value of attribute exporters.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def exporters @exporters end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def progress @progress end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def project @project end |
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
10 11 12 |
# File 'lib/boringbuilder/exporter.rb', line 10 def runtime @runtime end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/boringbuilder/exporter.rb', line 23 def call exporters.each(&:validate!) asset = build_asset unless exporters.empty? receipt = exporters.reduce(Exporters::Receipt.new) do |result, adapter| received = progress.step(export_step_name(adapter)) { adapter.export(asset) } merge_receipts(result, received) end reference = export_reference Result.new( format: configuration.format, path: receipt.path, reference: reference, runtime: runtime, platform: configuration.platform, artifact_id: receipt.artifact_id, artifact_name: receipt.artifact_name ) rescue DaggerRuby::DaggerError => e raise ExportError, "Dagger could not export the build: #{e.}" end |