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.
186 187 188 189 |
# File 'lib/aggkit/env.rb', line 186 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.
184 185 186 |
# File 'lib/aggkit/env.rb', line 184 def env_root @env_root end |
Instance Method Details
#core?(path) ⇒ Boolean
210 211 212 |
# File 'lib/aggkit/env.rb', line 210 def core? path return File.realpath(File.(path)) if File.exists?("#{path}/.core") end |
#core_root ⇒ Object
197 198 199 200 201 |
# File 'lib/aggkit/env.rb', line 197 def core_root @core_root = Pathfinder.new(project_root).each_parent.find do |path| core?(path) end end |
#project_root ⇒ Object
191 192 193 194 195 |
# File 'lib/aggkit/env.rb', line 191 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
203 204 205 206 207 208 |
# File 'lib/aggkit/env.rb', line 203 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 |