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

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

Defined Under Namespace

Modules: Cache

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



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

def parent
  @parent
end

Class Method Details

.extend_object(object) ⇒ Object



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

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

.instanciate(path, parent) ⇒ Object



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

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

#included?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/avm/launcher/instances/base.rb', line 71

def included?
  !::EacLauncher::Context.current.settings.excluded_projects.include?(project_name)
end

#nameObject



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

def name
  logical
end

#project?Boolean

Returns:

  • (Boolean)


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

def project?
  stereotypes.any?
end

#project_nameObject



67
68
69
# File 'lib/avm/launcher/instances/base.rb', line 67

def project_name
  ::File.basename(logical)
end

#publish_checkObject



58
59
60
61
62
63
64
65
# File 'lib/avm/launcher/instances/base.rb', line 58

def publish_check
  stereotypes.each do |s|
    next unless publish?(s)

    puts "#{name.to_s.cyan}|#{s.label}|" \
      "#{s.publish_class.new(self).check}"
  end
end

#publish_runObject



49
50
51
52
53
54
55
56
# File 'lib/avm/launcher/instances/base.rb', line 49

def publish_run
  stereotypes.each do |s|
    next unless publish?(s)

    infov(name, "publishing #{s.label}")
    s.publish_class.new(self).run
  end
end

#stereotype?(stereotype) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/avm/launcher/instances/base.rb', line 35

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

#to_hObject



75
76
77
# File 'lib/avm/launcher/instances/base.rb', line 75

def to_h
  super.to_h.merge(parent: parent ? parent.logical : nil)
end

#to_parent_pathObject



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

def to_parent_path
  return self unless @parent

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