Class: EacLauncher::Instances::Base
- Inherits:
-
Path
- Object
- String
- Path
- EacLauncher::Instances::Base
show all
- Includes:
- Eac::SimpleCache, Cache, EacRubyUtils::Console::Speaker
- Defined in:
- lib/eac_launcher/instances/base.rb,
lib/eac_launcher/instances/base/cache.rb
Defined Under Namespace
Modules: Cache
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Cache
#cache_key, #cache_path
Methods inherited from Path
#basename, #find_file_with_extension, #find_files_with_extension, #subpath
Constructor Details
#initialize(path, parent) ⇒ Base
Returns a new instance of Base.
12
13
14
15
|
# File 'lib/eac_launcher/instances/base.rb', line 12
def initialize(path, parent)
super(path)
@parent = parent
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
10
11
12
|
# File 'lib/eac_launcher/instances/base.rb', line 10
def parent
@parent
end
|
Instance Method Details
#children ⇒ Object
25
26
27
|
# File 'lib/eac_launcher/instances/base.rb', line 25
def children
scan(self)
end
|
#current_cache ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/eac_launcher/instances/base.rb', line 62
def current_cache
stereotypes.each do |s|
return s.warp_class.new(self) if s.warp_class
end
raise ::EacLauncher::Instances::Error, "None stereotype of \"#{to_root_path}\" has " \
"subclass \"CurrentCache\" (#{stereotypes.join(', ')})"
end
|
#project? ⇒ Boolean
38
39
40
|
# File 'lib/eac_launcher/instances/base.rb', line 38
def project?
stereotypes.any?
end
|
#project_name ⇒ Object
58
59
60
|
# File 'lib/eac_launcher/instances/base.rb', line 58
def project_name
File.basename(self)
end
|
#publish_check ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/eac_launcher/instances/base.rb', line 50
def publish_check
stereotypes.each do |s|
next unless publish?(s)
puts "#{to_root_path.to_s.cyan}|#{s.stereotype_name_in_color}|" \
"#{s.publish_class.new(self).check}"
end
end
|
#publish_run ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/eac_launcher/instances/base.rb', line 42
def publish_run
stereotypes.each do |s|
next unless publish?(s)
infov(to_root_path, "publishing #{s.stereotype_name_in_color}")
s.publish_class.new(self).run
end
end
|
#stereotype?(stereotype) ⇒ Boolean
21
22
23
|
# File 'lib/eac_launcher/instances/base.rb', line 21
def stereotype?(stereotype)
stereotypes.include?(stereotype)
end
|
#stereotypes_uncached ⇒ Object
#to_parent_path ⇒ Object
29
30
31
32
|
# File 'lib/eac_launcher/instances/base.rb', line 29
def to_parent_path
return self unless @parent
gsub(/\A#{Regexp.quote(@parent)}/, '')
end
|
#to_root_path ⇒ Object
34
35
36
|
# File 'lib/eac_launcher/instances/base.rb', line 34
def to_root_path
gsub(/\A#{root}/, '')
end
|