class Dapp::Dimg::Config::Directive::ArtifactBase::Export

Attributes

_cwd[RW]
_exclude_paths[RW]
_group[RW]
_include_paths[RW]
_owner[RW]
_to[RW]

Public Class Methods

new(cwd, **kwargs, &blk) click to toggle source
Calls superclass method Dapp::Config::Directive::Base::new
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 39
def initialize(cwd, **kwargs, &blk)
  self._cwd = cwd
  @_include_paths ||= []
  @_exclude_paths ||= []

  super(**kwargs, &blk)
end

Public Instance Methods

_artifact_options() click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 47
def _artifact_options
  {
    to:            _to,
    cwd:           _cwd,
    include_paths: _include_paths,
    exclude_paths: _exclude_paths,
    owner:         _owner,
    group:         _group
  }
end
_cwd=(value) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 58
def _cwd=(value)
  return if value.nil?
  raise ::Dapp::Error::Config, code: :export_cwd_absolute_path_required unless Pathname(value).absolute?
  @_cwd = path_format(value)
end
exclude_paths(*relative_paths) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 80
def exclude_paths(*relative_paths)
  sub_directive_eval do
    unless relative_paths.all? { |path| Pathname(path).relative? }
      raise ::Dapp::Error::Config, code: :export_exclude_paths_relative_path_required
    end
    _exclude_paths.concat(relative_paths.map(&method(:path_format)))
  end
end
group(group) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 93
def group(group)
  sub_directive_eval { @_group = group }
end
include_paths(*relative_paths) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 71
def include_paths(*relative_paths)
  sub_directive_eval do
    unless relative_paths.all? { |path| Pathname(path).relative? }
      raise ::Dapp::Error::Config, code: :export_include_paths_relative_path_required
    end
    _include_paths.concat(relative_paths.map(&method(:path_format)))
  end
end
owner(owner) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 89
def owner(owner)
  sub_directive_eval { @_owner = owner }
end
to(absolute_path) click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 64
def to(absolute_path)
  sub_directive_eval do
    raise ::Dapp::Error::Config, code: :export_to_absolute_path_required unless Pathname(absolute_path).absolute?
    @_to = path_format(absolute_path)
  end
end
validate!() click to toggle source
# File lib/dapp/dimg/config/directive/artifact_base.rb, line 97
def validate!
  raise ::Dapp::Error::Config, code: :export_to_required if _to.nil?
end