Module: Dapp::Dimg::Dapp::Dimg

Defined in:
lib/dapp/dimg/dapp/dimg.rb

Instance Method Summary collapse

Instance Method Details

#_terminate_dimg_on_terminate(dimg) ⇒ Object



35
36
37
# File 'lib/dapp/dimg/dapp/dimg.rb', line 35

def _terminate_dimg_on_terminate(dimg)
  @_call_before_terminate << proc{dimg.terminate}
end

#artifact_dimg(config:, **kwargs) ⇒ Object



11
12
13
14
15
# File 'lib/dapp/dimg/dapp/dimg.rb', line 11

def artifact_dimg(config:, **kwargs)
  dimg_after_define_hook(config: config, **kwargs) do
    (@artifacts_dimgs ||= {})[config._name] ||= ::Dapp::Dimg::Artifact.new(config: config, dapp: self, **kwargs)
  end
end

#artifact_dimg_layer(config:, **kwargs) ⇒ Object



31
32
33
# File 'lib/dapp/dimg/dapp/dimg.rb', line 31

def artifact_dimg_layer(config:, **kwargs)
  (@artifact_dimg_layers ||= {})[config._name] ||= ::Dapp::Dimg::Artifact.new(config: config, dapp: self, **kwargs)
end

#dimg(config:, **kwargs) ⇒ Object



5
6
7
8
9
# File 'lib/dapp/dimg/dapp/dimg.rb', line 5

def dimg(config:, **kwargs)
  dimg_after_define_hook(config: config, **kwargs) do
    (@dimg ||= {})[config._name] ||= ::Dapp::Dimg::Dimg.new(config: config, dapp: self, **kwargs)
  end
end

#dimg_after_define_hook(**kwargs) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/dapp/dimg/dapp/dimg.rb', line 17

def dimg_after_define_hook(**kwargs)
  should_be_built = kwargs[:should_be_built] || false
  yield.tap do |dimg|
    if should_be_built && dimg.should_be_built != should_be_built
      dimg.enable_should_be_built
      dimg.should_be_built!
    end
  end
end

#dimg_layer(config:, **kwargs) ⇒ Object



27
28
29
# File 'lib/dapp/dimg/dapp/dimg.rb', line 27

def dimg_layer(config:, **kwargs)
  (@dimg_layers ||= {})[config._name] ||= ::Dapp::Dimg::Dimg.new(config: config, dapp: self, **kwargs)
end