Created
January 9, 2012 04:19
-
-
Save bitmage/1581070 to your computer and use it in GitHub Desktop.
functions for finding rzr project root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.findParent = findParent = (dir, pred) -> | |
return null if dir == '/' | |
if pred(dir) | |
return dir | |
else | |
upDir = normalize(dir + '/..') | |
return findParent(upDir, pred) | |
end | |
rzrRootTest = (dir) -> | |
'domain' in readdirSync(dir) | |
exports.projectRoot = projectRoot = () -> | |
root ?= findParent process.cwd(), rzrRootTest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment