Sha256: 3754e75c777a558066c731098b75a75f78e2b82c9b3c4cf00f9eb4dc3cea8ffb
Contents?: true
Size: 733 Bytes
Versions: 4
Compression:
Stored size: 733 Bytes
Contents
require 'zeitwerk' require 'singleton' class MonoRepoDeps::Project::FindRoot include MonoRepoDeps::Mixins SYSTEM_ROOT = '/' sig do params(dir: String).returns(String) end def call(dir) init_dir = dir = File.expand_path(dir) unless File.exist?(init_dir) raise StandardError.new("path '#{init_dir}' does not exist") end loop do project_file_path = File.expand_path(File.join(dir, MonoRepoDeps::PROJECT_FILENAME)) if File.exist?(project_file_path) return dir elsif dir == SYSTEM_ROOT raise StandardError.new("#{MonoRepoDeps::PROJECT_FILENAME} for path '#{init_dir}' not found") else dir = File.expand_path("../", dir) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems