Created
August 26, 2012 23:50
-
-
Save niallo/3484450 to your computer and use it in GitHub Desktop.
project type detection heuristic predicate
This file contains hidden or 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
| // Detection predicate for Python language & known frameworks | |
| { | |
| // "exists" property can be a glob as supported by node-glob | |
| // https://github.com/isaacs/node-glob | |
| // | |
| // "grep" property is a JavaScript regular expression as described at | |
| // https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp | |
| // grep looks for the regular expression inside of the | |
| // Array predicates have an implicit OR | |
| // i.e. whichever rule evaluates to true first wins. | |
| // | |
| // implicit AND within rules, i.e. each property must be true for the result to be true. | |
| rules: [ | |
| // If setup.py exists AND it contains the lowercase string "pyramid", it is language python and framework pyramid | |
| {exists:"setup.py", grep:/pyramid/i, framework:"pyramid", language:"python"}, | |
| // If manage.py exists AND it contains the lowercase string "django", it is language python and framework django | |
| {exists:"manage.py", grep:/django/i, framework:"django", language:"python"}, | |
| // If setup.py exists, it is language python and framework null (unknown) | |
| {exists:"setup.py", language:"python", framework:null} | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment