Sha256: 52290233f7e3a66e61a983fb07d61e8c9d96a0610fdc4d0e3f1412b1faa9baca
Contents?: true
Size: 701 Bytes
Versions: 2
Compression:
Stored size: 701 Bytes
Contents
require 'zeitwerk' require 'singleton' class Mona::Project::FindRoot include Mona::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, Mona::PROJECT_FILENAME)) if File.exist?(project_file_path) return dir elsif dir == SYSTEM_ROOT raise StandardError.new("#{Mona::PROJECT_FILENAME} for path '#{init_dir}' not found") else dir = File.expand_path("../", dir) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mona-0.2.3 | lib/mona/project/find_root.rb |
mona-0.2.2 | lib/mona/project/find_root.rb |