Sha256: fec1ed6756a329e544cf63482bfec02f4ea829b7afbf7857ee8e6960bdb52062
Contents?: true
Size: 1.51 KB
Versions: 14
Compression:
Stored size: 1.51 KB
Contents
module Climatic module ConfigLayers class ExecutableGemLayer < Climatic::ConfigLayers::GenericLayer 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 def executable_gem_config_root self.class.executable_gem_config_root end 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 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 end end end
Version data entries
14 entries across 14 versions & 1 rubygems