Module: App::Root
- Included in:
- App
- Defined in:
- lib/app/app/root.rb
Overview
– app root —————————————————————
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find ⇒ Object
22 23 24 |
# File 'lib/app/app/root.rb', line 22 def self.find find_starting_in(Dir.getwd) || raise("Could not find application root for #{dir}") end |
.find_starting_in(dir) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/app/app/root.rb', line 6 def self.find_starting_in(dir) if is_root?(dir) dir elsif !dir.sub!(/\/[^\/]+$/, "") nil else find_starting_in(dir) end end |
.is_root?(dir) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/app/app/root.rb', line 16 def self.is_root?(dir) File.exists?("#{dir}/config.ru") || File.exists?("#{dir}/Gemfile") || File.exists?("#{dir}/Procfile") end |