Module: Avm::Launcher::Instances::Base

Defined in:
lib/avm/launcher/instances/base.rb,
lib/avm/launcher/instances/base/cache.rb,
lib/avm/launcher/instances/base/publishing.rb

Defined Under Namespace

Modules: Cache, Publishing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



30
31
32
# File 'lib/avm/launcher/instances/base.rb', line 30

def parent
  @parent
end

Class Method Details

.extend_object(object) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/avm/launcher/instances/base.rb', line 11

def extend_object(object)
  object.extend ::EacRubyUtils::SimpleCache
  object.extend ::EacRubyUtils::Speaker::Sender
  object.extend ::Avm::Launcher::Instances::Base::Cache
  object.extend ::Avm::Launcher::Instances::Base::Publishing
  super
end

.instanciate(path, parent) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/avm/launcher/instances/base.rb', line 19

def instanciate(path, parent)
  unless path.is_a?(::Avm::Launcher::Instances::Base)
    raise ::Avm::Launcher::Errors::NonProject, path unless path.project?

    path.extend(::Avm::Launcher::Instances::Base)
    path.parent = parent
  end
  path
end

Instance Method Details

#applicationAvm::Applications::Base



33
34
35
# File 'lib/avm/launcher/instances/base.rb', line 33

def application
  @application ||= ::Avm::Registry.applications.detect(project_name)
end

#included?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/avm/launcher/instances/base.rb', line 59

def included?
  ::Avm::Launcher::Context.current.settings.excluded_projects.exclude?(project_name)
end

#nameObject



37
38
39
# File 'lib/avm/launcher/instances/base.rb', line 37

def name
  logical
end

#project?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/avm/launcher/instances/base.rb', line 51

def project?
  stereotypes.any?
end

#project_nameObject



55
56
57
# File 'lib/avm/launcher/instances/base.rb', line 55

def project_name
  ::File.basename(logical)
end

#stereotype?(stereotype) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/avm/launcher/instances/base.rb', line 41

def stereotype?(stereotype)
  stereotypes.include?(stereotype)
end

#to_hObject



63
64
65
# File 'lib/avm/launcher/instances/base.rb', line 63

def to_h
  super.to_h.merge(parent: parent&.logical)
end

#to_parent_pathObject



45
46
47
48
49
# File 'lib/avm/launcher/instances/base.rb', line 45

def to_parent_path
  return self unless @parent

  logical.gsub(/\A#{Regexp.quote(@parent.logical)}/, '')
end