Class: Dapp::Dimg::Config::Directive::ArtifactGroup

Inherits:
DimgGroup show all
Defined in:
lib/dapp/dimg/config/directive/artifact_group.rb

Instance Attribute Summary

Attributes included from Dimg::InstanceMethods

#_artifact, #_artifact_groups, #_builder, #_chef, #_git_artifact, #_mount

Instance Method Summary collapse

Methods inherited from DimgGroup

#artifact, #chef, #docker, #git, #mount, #shell

Methods included from Dimg::InstanceMethods

#_import_artifact, #artifact, #chef, #docker, #git, #mount, #shell

Methods included from DimgGroupBase

#_dimg, #_dimg_group, #dimg, #dimg_group

Methods inherited from Base

#clone_to_artifact

Methods inherited from Config::Directive::Base

#clone, #initialize

Constructor Details

This class inherits a constructor from Dapp::Config::Directive::Base

Instance Method Details

#_docker(&blk) ⇒ Object



18
19
20
# File 'lib/dapp/dimg/config/directive/artifact_group.rb', line 18

def _docker(&blk)
  @_docker ||= Docker::Artifact.new(dapp: dapp, &blk)
end

#_exportObject



22
23
24
# File 'lib/dapp/dimg/config/directive/artifact_group.rb', line 22

def _export
  @_export ||= []
end

#_shell(&blk) ⇒ Object



14
15
16
# File 'lib/dapp/dimg/config/directive/artifact_group.rb', line 14

def _shell(&blk)
  @_shell ||= Shell::Artifact.new(dapp: dapp, &blk)
end

#export(*args, &blk) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/dapp/dimg/config/directive/artifact_group.rb', line 6

def export(*args, &blk)
  artifact_config = pass_to(ArtifactDimg.new("artifact-#{SecureRandom.hex(2)}", dapp: dapp))
  artifact = Artifact.new(dapp: dapp, config: artifact_config)
  artifact.export(*args, &blk).tap do
    _export.concat artifact._export
  end
end

#validate!Object



26
27
28
# File 'lib/dapp/dimg/config/directive/artifact_group.rb', line 26

def validate!
  _export.each(&:validate!)
end