class Dip::Config::ConfigFinder
Attributes
file_path[R]
override[R]
Public Class Methods
new(work_dir, override: false)
click to toggle source
# File lib/dip/config.rb, line 28 def initialize(work_dir, override: false) @override = override @file_path = if ENV["DIP_FILE"] Pathname.new(prepared_name(ENV["DIP_FILE"])) else find(Pathname.new(work_dir)) end end
Public Instance Methods
exist?()
click to toggle source
# File lib/dip/config.rb, line 38 def exist? file_path&.exist? end
Private Instance Methods
find(path)
click to toggle source
# File lib/dip/config.rb, line 52 def find(path) file = path.join(prepared_name(DEFAULT_PATH)) return file if file.exist? return if path.root? find(path.parent) end
prepared_name(path)
click to toggle source
# File lib/dip/config.rb, line 46 def prepared_name(path) return path unless override path.gsub(/\.yml$/, ".override.yml") end