class Aggkit::Env::Pathfinder
Attributes
path[RW]
Public Class Methods
new(path)
click to toggle source
# File lib/aggkit/env.rb, line 177 def initialize(path) @path = File.realpath(File.expand_path(path)) end
Public Instance Methods
each_env()
click to toggle source
# File lib/aggkit/env.rb, line 191 def each_env Dir.chdir(File.join(path, 'envs')) do Dir.glob('**/*').select do |f| File.directory? f end.select do |f| File.exist?(File.join(f, '.env')) || File.exist?(File.join(f, 'docker-compose.yml')) || File.exist?(File.join(f, 'docker-compose.yaml')) end.sort end end
each_parent()
click to toggle source
# File lib/aggkit/env.rb, line 181 def each_parent current = path.split(File::SEPARATOR) Enumerator.new do |y| until current.empty? y << current.join(File::SEPARATOR) current.pop end end end