Method: Nginxtra::Config::SimpleConfig#find_config_files!

Defined in:
lib/nginxtra/config.rb

#find_config_files!(path) ⇒ Object

Find all the config files at the given path directory. The result will be a hash of hashes. The key on the outer hash is the output config file name, while the value is a hash of :path to the original file path, and :config_file to the output config file name.



608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/nginxtra/config.rb', line 608

def find_config_files!(path)
  files_hash = {}

  Dir["#{path}/**/*.rb"].select do |x|
    File.file? x
  end.map do |x|
    file_name = x.sub /^#{Regexp.quote "#{path}"}\/(.*)\.rb$/, "\\1"
    { :path => x, :config_file => file_name }
  end.each do |x|
    files_hash[x[:config_file]] = x
  end

  files_hash
end