Class: Climatic::ConfigLayers::GemLayer
- Inherits:
-
GenericLayer
- Object
- SuperStack::Layer
- GenericLayer
- Climatic::ConfigLayers::GemLayer
- Defined in:
- lib/climatic/config_layers/gem_layer.rb
Constant Summary
Constants included from SourceHelper
SourceHelper::DEFAULT_OS_FLAVOUR, SourceHelper::EXTENSIONS, SourceHelper::OS_FLAVOURS
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
Returns the value of attribute gem_name.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from GenericLayer
#initialize, #possible_config_files, #rescan
Methods included from SourceHelper
included, os_flavour, #os_flavour, supported_oses, #supported_oses
Constructor Details
This class inherits a constructor from Climatic::ConfigLayers::GenericLayer
Instance Attribute Details
#gem_name ⇒ Object
Returns the value of attribute gem_name.
6 7 8 |
# File 'lib/climatic/config_layers/gem_layer.rb', line 6 def gem_name @gem_name end |
Class Method Details
.gem_config_root(gem_name) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/climatic/config_layers/gem_layer.rb', line 8 def self.gem_config_root(gem_name) return nil unless gem_name Gem.loaded_specs.each_pair do |name, spec| return spec.full_gem_path if name == gem_name end nil end |
Instance Method Details
#gem_config_root ⇒ Object
16 17 18 |
# File 'lib/climatic/config_layers/gem_layer.rb', line 16 def gem_config_root self.class.gem_config_root gem_name end |
#perform_substitutions(path_part) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/climatic/config_layers/gem_layer.rb', line 38 def perform_substitutions path_part return nil unless gem_config_root res = path_part.dup res.gsub! '##GEM_CONFIG_ROOT##', gem_config_root res.gsub! '##GEM_NAME##', gem_name if self.respond_to? :gem_name res end |
#possible_sources ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/climatic/config_layers/gem_layer.rb', line 27 def possible_sources [ %w(##GEM_CONFIG_ROOT## etc ##GEM_NAME##.##EXTENSION##), %w(##GEM_CONFIG_ROOT## etc ##GEM_NAME## config.##EXTENSION##), %w(##GEM_CONFIG_ROOT## etc ##GEM_NAME## ##GEM_NAME##.##EXTENSION##), %w(##GEM_CONFIG_ROOT## config ##GEM_NAME##.##EXTENSION##), %w(##GEM_CONFIG_ROOT## config ##GEM_NAME## config.##EXTENSION##), %w(##GEM_CONFIG_ROOT## config ##GEM_NAME## ##GEM_NAME##.##EXTENSION##) ] end |