Method: Mycmd::Configuration.config_find

Defined in:
lib/mycmd/configuration.rb

.config_find(path = File.expand_path(".")) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mycmd/configuration.rb', line 80

def config_find(path = File.expand_path("."))
  file = File.join(path, CONFIG_FILE)
  if File.exists?(file)
    file
  else
    if path == "/"
      file = File.join(ENV["HOME"], CONFIG_FILE)
      File.exists?(file) ? file : nil
    else
      config_find(File.expand_path("..", path))
    end
  end
end