Class: Aggkit::Env::Project
- Inherits:
-
Object
- Object
- Aggkit::Env::Project
- Defined in:
- lib/aggkit/env.rb
Instance Attribute Summary collapse
-
#env_root ⇒ Object
Returns the value of attribute env_root.
Instance Method Summary collapse
- #core?(path) ⇒ Boolean
- #core_root ⇒ Object
-
#initialize(path) ⇒ Project
constructor
A new instance of Project.
- #project_root ⇒ Object
- #root?(path) ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Project
Returns a new instance of Project.
196 197 198 199 |
# File 'lib/aggkit/env.rb', line 196 def initialize path raise "env path #{path} is not directory!" if !File.directory?(File.(path)) @env_root = File.realpath(File.(path)) end |
Instance Attribute Details
#env_root ⇒ Object
Returns the value of attribute env_root.
194 195 196 |
# File 'lib/aggkit/env.rb', line 194 def env_root @env_root end |
Instance Method Details
#core?(path) ⇒ Boolean
220 221 222 |
# File 'lib/aggkit/env.rb', line 220 def core? path return File.realpath(File.(path)) if File.exists?("#{path}/.core") end |
#core_root ⇒ Object
207 208 209 210 211 |
# File 'lib/aggkit/env.rb', line 207 def core_root @core_root = Pathfinder.new(project_root).each_parent.find do |path| core?(path) end end |
#project_root ⇒ Object
201 202 203 204 205 |
# File 'lib/aggkit/env.rb', line 201 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) ⇒ Boolean
213 214 215 216 217 218 |
# File 'lib/aggkit/env.rb', line 213 def root? path return File.realpath(File.(path)) if File.directory?("#{path}/.git") || File.exists?("#{path}/base-service.yml") || File.exists?("#{path}/common-services.yml") || File.directory?("#{path}/envs") end |