class Bake::Context

def self.bakefile_path(path, bakefile: BAKEFILE)

Returns:
  • (String, nil) - the path to the bakefile if it could be found.
def self.bakefile_path(path, bakefile: BAKEFILE)
	if File.file?(path)
		return path
	end
	
	current = path
	
	while current
		bakefile_path = File.join(current, BAKEFILE)
		
		if File.exist?(bakefile_path)
			return bakefile_path
		end
		
		parent = File.dirname(current)
		
		if current == parent
			break
		else
			current = parent
		end
	end
	
	return nil
end