Class: Bosh::Cli::ArchiveBuilder
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #build(resource) ⇒ Object
- #dry_run? ⇒ Boolean
- #final? ⇒ Boolean
-
#initialize(archive_repository_provider, options = {}) ⇒ ArchiveBuilder
constructor
A new instance of ArchiveBuilder.
Constructor Details
#initialize(archive_repository_provider, options = {}) ⇒ ArchiveBuilder
Returns a new instance of ArchiveBuilder.
5 6 7 8 |
# File 'lib/cli/archive_builder.rb', line 5 def initialize(archive_repository_provider, = {}) @archive_repository_provider = archive_repository_provider = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/cli/archive_builder.rb', line 3 def end |
Instance Method Details
#build(resource) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cli/archive_builder.rb', line 10 def build(resource) @archive_repository = @archive_repository_provider.get(resource) resource.run_script(:prepare) artifact = nil with_indent(' ') do artifact = locate_artifact(resource) if artifact.nil? artifact = create_artifact(resource) say("Generated version '#{artifact.fingerprint}'".make_green) unless dry_run? artifact = @archive_repository.install(artifact) end end if final? && !dry_run? say("Uploading final version '#{artifact.version}'...") artifact, blobstore_id = @archive_repository.upload_to_blobstore(artifact) say("Uploaded, blobstore id '#{blobstore_id}'") end end artifact rescue Bosh::Blobstore::BlobstoreError => e raise BlobstoreError, "Blobstore error: #{e}" end |
#dry_run? ⇒ Boolean
38 39 40 |
# File 'lib/cli/archive_builder.rb', line 38 def dry_run? !![:dry_run] end |
#final? ⇒ Boolean
42 43 44 |
# File 'lib/cli/archive_builder.rb', line 42 def final? !![:final] end |