lib/volt/utils/recursive_exists.rb

Summary

Maintainability
A
25 mins
Test Coverage
module Volt
  module RecursiveExists
    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
  end
end