Module: Waw::Kern::Utils

Included in:
App
Defined in:
lib/waw/kern/utils.rb

Overview

Utilities of the waw kernel

Instance Method Summary collapse

Instance Method Details

#find_web_root(from) ⇒ Object

Finds the root of the waw application by traversing the file system up from from until a waw.deploy file can be found. Returns the root_folder that contains the waw.deploy file.

This method raises a WawError if the waw.deploy file cannot be found.



15
16
17
18
19
20
21
22
23
# File 'lib/waw/kern/utils.rb', line 15

def find_web_root(from)
  web_root = File.expand_path(from)
  from = File.dirname(from) if File.file?(from)
  until File.exists?(File.join(web_root, 'waw.deploy')) or File.exists?(File.join(web_root, 'wawdeploy'))
    web_root = File.expand_path(File.join(web_root, '..'))
    raise WawError, "Unable to find waw.deploy file from folder #{from}" if web_root == '/'
  end
  web_root
end