module EacLauncher::Instances::Base

Attributes

parent[RW]

Public Class Methods

extend_object(object) click to toggle source
Calls superclass method
# File lib/eac_launcher/instances/base.rb, line 9
def extend_object(object)
  object.extend ::EacRubyUtils::SimpleCache
  object.extend ::EacRubyUtils::Console::Speaker
  object.extend ::EacLauncher::Instances::Base::Cache
  super
end
instanciate(path, parent) click to toggle source
# File lib/eac_launcher/instances/base.rb, line 16
def instanciate(path, parent)
  unless path.is_a?(::EacLauncher::Instances::Base)
    raise "#{path} is not a project" unless path.project?

    path.extend(::EacLauncher::Instances::Base)
    path.parent = parent
  end
  path
end

Public Instance Methods

included?() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 69
def included?
  !::EacLauncher::Context.current.settings.excluded_projects.include?(project_name)
end
name() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 29
def name
  logical
end
project?() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 43
def project?
  stereotypes.any?
end
project_name() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 65
def project_name
  ::File.basename(logical)
end
publish_check() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 56
def publish_check
  stereotypes.each do |s|
    next unless publish?(s)

    puts "#{name.to_s.cyan}|#{s.stereotype_name_in_color}|" \
      "#{s.publish_class.new(self).check}"
  end
end
publish_run() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 47
def publish_run
  stereotypes.each do |s|
    next unless publish?(s)

    infov(name, "publishing #{s.stereotype_name_in_color}")
    s.publish_class.new(self).run
  end
end
stereotype?(stereotype) click to toggle source
# File lib/eac_launcher/instances/base.rb, line 33
def stereotype?(stereotype)
  stereotypes.include?(stereotype)
end
to_h() click to toggle source
Calls superclass method
# File lib/eac_launcher/instances/base.rb, line 73
def to_h
  super.to_h.merge(parent: parent ? parent.logical : nil)
end
to_parent_path() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 37
def to_parent_path
  return self unless @parent

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

Private Instance Methods

options_uncached() click to toggle source
# File lib/eac_launcher/instances/base.rb, line 86
def options_uncached
  ::EacLauncher::Context.current.settings.instance_settings(self)
end
publish?(stereotype) click to toggle source
# File lib/eac_launcher/instances/base.rb, line 79
def publish?(stereotype)
  return false unless stereotype.publish_class

  filter = ::EacLauncher::Context.current.publish_options[:stereotype]
  filter.blank? ? true : filter == stereotype.name.demodulize
end