Module: EacLauncher::Instances::Base
- Defined in:
- lib/eac_launcher/instances/base.rb,
lib/eac_launcher/instances/base/cache.rb
Defined Under Namespace
Modules: Cache
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
- #included? ⇒ Boolean
- #name ⇒ Object
- #project? ⇒ Boolean
- #project_name ⇒ Object
- #publish_check ⇒ Object
- #publish_run ⇒ Object
- #stereotype?(stereotype) ⇒ Boolean
- #to_h ⇒ Object
- #to_parent_path ⇒ Object
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
27 28 29 |
# File 'lib/eac_launcher/instances/base.rb', line 27 def parent @parent end |
Class Method Details
.extend_object(object) ⇒ Object
9 10 11 12 13 14 |
# 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) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# 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 |
Instance Method Details
#included? ⇒ Boolean
69 70 71 |
# File 'lib/eac_launcher/instances/base.rb', line 69 def included? !::EacLauncher::Context.current.settings.excluded_projects.include?(project_name) end |
#name ⇒ Object
29 30 31 |
# File 'lib/eac_launcher/instances/base.rb', line 29 def name logical end |
#project? ⇒ Boolean
43 44 45 |
# File 'lib/eac_launcher/instances/base.rb', line 43 def project? stereotypes.any? end |
#project_name ⇒ Object
65 66 67 |
# File 'lib/eac_launcher/instances/base.rb', line 65 def project_name ::File.basename(logical) end |
#publish_check ⇒ Object
56 57 58 59 60 61 62 63 |
# 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 ⇒ Object
47 48 49 50 51 52 53 54 |
# 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) ⇒ Boolean
33 34 35 |
# File 'lib/eac_launcher/instances/base.rb', line 33 def stereotype?(stereotype) stereotypes.include?(stereotype) end |
#to_h ⇒ Object
73 74 75 |
# 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 ⇒ Object
37 38 39 40 41 |
# 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 |