Module: Volt::RecursiveExists

Defined in:
lib/volt/utils/recursive_exists.rb

Class Method Summary collapse

Class Method Details

.exists_here_or_up?(file) ⇒ Boolean

Returns:



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/volt/utils/recursive_exists.rb', line 3

def self.exists_here_or_up?(file)
  # Check for a gemfile here or up a directory
  pwd = Dir.pwd

  loop do
    if File.exists?("#{pwd}/#{file}")
      return true
    else
      pwd = pwd.gsub(/\/[^\/]+$/, '')
      return false if pwd == ''
    end
  end

  false
end