Class: Convoy::Setup::Configuration::Locator::DescendingToHome

Inherits:
Base
  • Object
show all
Defined in:
lib/convoy/setup/configuration/locator/descending_to_home.rb

Instance Attribute Summary

Attributes inherited from Base

#filename

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Convoy::Setup::Configuration::Locator::Base

Instance Method Details

#locateObject


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/convoy/setup/configuration/locator/descending_to_home.rb', line 8

def locate
    return nil unless filename
    possible_configs = []
    Pathname.new(Dir.pwd).descend do |path|
        filepath = File.join(path, filename)
        if File.exists?(filepath)
            possible_configs << filepath
        end
    end
    possible_configs.empty? ? nil : possible_configs.last
end