module Volt::RecursiveExists

Public Class Methods

exists_here_or_up?(file) click to toggle source
# 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