class Dapp::Dimg::Config::Directive::Artifact::Export

Attributes

_after[RW]
_before[RW]
_config[RW]

Public Instance Methods

_cwd() click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 25
def _cwd
  @_cwd ||= @_to
end
_to() click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 29
def _to
  @_to ||= @_cwd
end
after(stage) click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 41
def after(stage)
  sub_directive_eval do
    stage = stage.to_sym
    associate_validation!(:after, stage, @_after)
    @_after = stage
  end
end
before(stage) click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 33
def before(stage)
  sub_directive_eval do
    stage = stage.to_sym
    associate_validation!(:before, stage, @_before)
    @_before = stage
  end
end
not_associated?() click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 49
def not_associated?
  (_before || _after).nil?
end

Protected Instance Methods

associate_validation!(type, stage, _old_stage) click to toggle source
# File lib/dapp/dimg/config/directive/artifact.rb, line 55
def associate_validation!(type, stage, _old_stage)
  conflict_type = [:before, :after].find { |t| t != type }
  conflict_stage = public_send("_#{conflict_type}")

  raise ::Dapp::Error::Config, code: :stage_artifact_not_supported_associated_stage,
                               data: { stage: "#{type} #{stage.inspect}" } unless [:install, :setup].include? stage

  raise ::Dapp::Error::Config, code: :stage_artifact_double_associate,
                               data: { stage: "#{type} #{stage.inspect}",
                                       conflict_stage: "#{conflict_type} #{conflict_stage.inspect}" } if conflict_stage
end