Sha256: 55685fc03fd0e3c8f5e6057880fe93bdd4fe7ead26f646af9f9cc9d6d1636340
Contents?: true
Size: 879 Bytes
Versions: 56
Compression:
Stored size: 879 Bytes
Contents
class KuberKit::Tools::WorkdirDetector include KuberKit::Import[ "configs", "tools.file_presence_checker" ] def call(options, current_dir: nil) current_dir ||= Dir.pwd default_dir = File.join(current_dir, configs.kuber_kit_dirname) workdir_path = options[:path] || ENV['KUBER_KIT_PATH'] || default_dir unless file_presence_checker.dir_exists?(workdir_path) workdir_in_ancestors = find_workdir_in_ancestors(current_dir) workdir_path = workdir_in_ancestors if workdir_in_ancestors end workdir_path end private def find_workdir_in_ancestors(dir) if dir == "/" return nil end workdir_path = File.join(dir, configs.kuber_kit_dirname) if file_presence_checker.dir_exists?(workdir_path) return workdir_path end find_workdir_in_ancestors(File.dirname(dir)) end end
Version data entries
56 entries across 56 versions & 1 rubygems