Class: Climatic::ConfigLayers::ExecutableGemLayer
- Inherits:
-
GenericLayer
- Object
- SuperStack::Layer
- GenericLayer
- Climatic::ConfigLayers::ExecutableGemLayer
- Defined in:
- lib/climatic/config_layers/executable_gem_layer.rb
Constant Summary
Constants included from SourceHelper
SourceHelper::DEFAULT_OS_FLAVOUR, SourceHelper::EXTENSIONS, SourceHelper::OS_FLAVOURS
Class Method Summary collapse
Instance Method Summary collapse
- #executable_gem_config_root ⇒ Object
- #perform_substitutions(path_part) ⇒ Object
- #possible_sources ⇒ Object
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
Class Method Details
.executable_gem_config_root ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/climatic/config_layers/executable_gem_layer.rb', line 7 def self.executable_gem_config_root return nil unless $PROGRAM_NAME Gem.loaded_specs.each_pair do |name, spec| executable_basename = File.basename($PROGRAM_NAME) return spec.full_gem_path if spec.executables.include? executable_basename end nil end |
Instance Method Details
#executable_gem_config_root ⇒ Object
17 18 19 |
# File 'lib/climatic/config_layers/executable_gem_layer.rb', line 17 def executable_gem_config_root self.class.executable_gem_config_root end |
#perform_substitutions(path_part) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/climatic/config_layers/executable_gem_layer.rb', line 32 def perform_substitutions path_part return nil unless executable_gem_config_root res = path_part.dup res.gsub! '##EXECUTABLE_GEM_CONFIG_ROOT##', executable_gem_config_root exec_name = manager.nil? ? Climatic::LayersManager.default_config_file_base_name : manager.config_file_base_name res.gsub! '##PROGRAM_NAME##', exec_name res end |
#possible_sources ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/climatic/config_layers/executable_gem_layer.rb', line 21 def possible_sources [ %w(##EXECUTABLE_GEM_CONFIG_ROOT## etc ##PROGRAM_NAME##.##EXTENSION##), %w(##EXECUTABLE_GEM_CONFIG_ROOT## etc ##PROGRAM_NAME## config.##EXTENSION##), %w(##EXECUTABLE_GEM_CONFIG_ROOT## etc ##PROGRAM_NAME## ##PROGRAM_NAME##.##EXTENSION##), %w(##EXECUTABLE_GEM_CONFIG_ROOT## config ##PROGRAM_NAME##.##EXTENSION##), %w(##EXECUTABLE_GEM_CONFIG_ROOT## config ##PROGRAM_NAME## config.##EXTENSION##), %w(##EXECUTABLE_GEM_CONFIG_ROOT## config ##PROGRAM_NAME## ##PROGRAM_NAME##.##EXTENSION##) ] end |