class Aggkit::Env::Project

Attributes

env_root[RW]

Public Class Methods

new(path) click to toggle source
# File lib/aggkit/env.rb, line 209
def initialize(path)
  raise "env path #{path} is not directory!" unless File.directory?(File.expand_path(path))

  @env_root = File.realpath(File.expand_path(path))
end

Public Instance Methods

core?(path) click to toggle source
# File lib/aggkit/env.rb, line 234
def core?(path)
  return File.realpath(File.expand_path(path)) if File.exist?("#{path}/.core")
end
core_root() click to toggle source
# File lib/aggkit/env.rb, line 221
def core_root
  @core_root = Pathfinder.new(project_root).each_parent.find do |path|
    core?(path)
  end
end
project_root() click to toggle source
# File lib/aggkit/env.rb, line 215
def project_root
  @project_root = Pathfinder.new(env_root).each_parent.find do |path|
    root?(path)
  end || (raise "Can't find project root")
end
root?(path) click to toggle source
# File lib/aggkit/env.rb, line 227
def root?(path)
  return File.realpath(File.expand_path(path)) if File.directory?("#{path}/.git") ||
    File.exist?("#{path}/base-service.yml") ||
    File.exist?("#{path}/common-services.yml") ||
    File.directory?("#{path}/envs")
end