Project type detection library for Node.JS using declarative heuristic predicates
Project type detection library using declarative heuristic predicates.
Say you have a Git repo on disk, and you want to figure out what kind of
language it is written in, what framework it uses, etc. With simple heuristics
such as looking for a
package.json file in the project root, this can be
Gumshoe makes it easy to specify these heuristics declaritively using predicates:
// Detect a node.js projectvar rules =filename:"package.json" exists:true language:"node.js"
More complicated example:
// Detect a node.js project using connect, express or null frameworksvar rules =filename:"package.json" grep:/express/i language:"node.js" framework:"express"filename:"package.json" grep:/connect/i language:"node.js" framework:"connect"filename:"package.json" exists:true language:"node.js" framework:null
Gumshoe is available in NPM.
npm install gumshoe
var gumshoe = require'gumshoe'// Use current working dirvar baseDir = processcwd// Detect a node.js projectvar rules =filename:"package.json" exists:true language:"node.js"gumshoerunbaseDir rulesif errconsole.log"Detection error: %s" errprocessexit1console.log"Detected language: %s" reslanguage
Gumshoe comes with tests. To run, simply execute
Gumshoe is released under a BSD license.
Picture of Legoman gumshoe CC-BY Herb Real from http://www.flickr.com/photos/venndiagram/5328211162/