Sha256: 1dda7fc01220fb0c45f6ba3a15d884a2ee4b84c98a51b13af099b0b36fb6a919
Contents?: true
Size: 641 Bytes
Versions: 17
Compression:
Stored size: 641 Bytes
Contents
# frozen_string_literal: true class Ree::PackagesSchemaLocator def call(path) find_source_path_in_hierarchy(path) end private def find_source_path_in_hierarchy(some_path) some_path = File.expand_path(some_path) raise Ree::Error.new("#{Ree::PACKAGES_SCHEMA_FILE} not found", :packages_json_not_found) if some_path == '/' return potential_file(some_path) if present?(some_path) find_source_path_in_hierarchy(File.dirname(some_path)) end def present?(some_path) File.exist?(potential_file(some_path)) end def potential_file(some_path) File.join(some_path, Ree::PACKAGES_SCHEMA_FILE) end end
Version data entries
17 entries across 17 versions & 1 rubygems