Module: Velcro::FileHelpers

Included in:
Brewfile, Lockfile
Defined in:
lib/velcro/file_helpers.rb

Instance Method Summary collapse

Instance Method Details

#locationObject



3
4
5
# File 'lib/velcro/file_helpers.rb', line 3

def location
  ENV['VELCRO_BREWFILE'] || recursive_search
end

#recursive_search(directory = Dir.pwd) ⇒ Object



7
8
9
10
11
12
# File 'lib/velcro/file_helpers.rb', line 7

def recursive_search(directory = Dir.pwd)
  until directory == '/'
    return directory if File.exists?(brewfile_in(directory))
    directory = File.expand_path(File.join(directory, '..'))
  end
end