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.
209 210 211 212 213 |
# File 'lib/aggkit/env.rb', line 209 def initialize(path) raise "env path #{path} is not directory!" unless File.directory?(File.(path)) @env_root = File.realpath(File.(path)) end |
Instance Attribute Details
#env_root ⇒ Object
Returns the value of attribute env_root.
207 208 209 |
# File 'lib/aggkit/env.rb', line 207 def env_root @env_root end |
Instance Method Details
#core?(path) ⇒ Boolean
234 235 236 |
# File 'lib/aggkit/env.rb', line 234 def core?(path) return File.realpath(File.(path)) if File.exist?("#{path}/.core") end |
#core_root ⇒ Object
221 222 223 224 225 |
# 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 ⇒ Object
215 216 217 218 219 |
# 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) ⇒ Boolean
227 228 229 230 231 232 |
# File 'lib/aggkit/env.rb', line 227 def root?(path) return File.realpath(File.(path)) if File.directory?("#{path}/.git") || File.exist?("#{path}/base-service.yml") || File.exist?("#{path}/common-services.yml") || File.directory?("#{path}/envs") end |