lib/pdk/util.rb
# Searches upwards from current working directory for the given target file.
#
# @param target [String] Name of file to search for.
# @param start_dir [String] Directory to start searching from, defaults to Dir.pwd
#
# @return [String, nil] Fully qualified path to the given target file if found,
#   nil if the target file could not be found.
Searches upwards from current working directory for the given target file.
Searches upwards from current working directory for the given target file .
def find_upwards(target, start_dir = nil)
      previous = nil
      current  = File.expand_path(start_dir || Dir.pwd)
      until !File.directory?(current) || current == previous
        filename = File.join(current, target)
        return filename if File.file?(filename)
        previous = current
        current = File.expand_path('..', current)
      end
    end
def find_upwards ( target , start_dir = nil ) previous = nil current = File . expand_path ( start_dir || Dir . pwd ) until ! File . directory? ( current ) || current == previous filename = File . join ( current , target ) return filename if File . file? ( filename ) previous = current current = File . expand_path ( '..' , current ) end end
Searches upwards from current working directory for the given target file.
Searches upwards from current working directory for the given target file .
Fully qualified path to the given target file if found, nil if the target file could not be found.
Fully qualified path to the given target file if found nil if the target file could not be found .
String, nil
target
Name of file to search for.
Name of file to search for .
start_dir
Directory to start searching from, defaults to Dir.pwd
Directory to start searching from defaults to Dir . pwd
Dir.pwd