Skip to content

Instantly share code, notes, and snippets.

@niallo
Created August 26, 2012 23:50
Show Gist options
  • Save niallo/3484450 to your computer and use it in GitHub Desktop.
Save niallo/3484450 to your computer and use it in GitHub Desktop.
project type detection heuristic predicate
// 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