Module: RareMap::RailsLocator
- Included in:
- Mapper
- Defined in:
- lib/rare_map/rails_locator.rb
Instance Method Summary collapse
Instance Method Details
#locate_rails_root(depth = 5) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rare_map/rails_locator.rb', line 3 def locate_rails_root(depth = 5) rails_dirs = ['app', 'config', 'db', 'lib', 'log', 'public'] depth.times do |level| found = true path = '' level.times { path << '../' } rails_dirs.each do |dir| found = false unless Dir.exist?(path + dir) end return path if found end nil end |