GithubHelp home page GithubHelp logo

caseman / gumshoe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from niallo/gumshoe

0.0 2.0 0.0 73 KB

Project type detection library for Node.JS using declarative heuristic predicates

License: MIT License

gumshoe's Introduction

Gumshoe

Gumshoe picture

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 easily deduced.

Gumshoe makes it easy to specify these heuristics declaritively using predicates:

// Detect a node.js project
var rules = [
    {filename:"package.json", exists:true, language:"node.js"}
]

More complicated example:

// Detect a node.js project using connect, express or null frameworks
var 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}
]

Installation

Gumshoe is available in NPM. npm install gumshoe

Example

  var gumshoe = require('gumshoe')

  // Use current working dir
  var baseDir = process.cwd()
  // Detect a node.js project
  var rules = [
      {filename:"package.json", exists:true, language:"node.js"}
  ]

  gumshoe.run(baseDir, rules, function(err, res) {
    if (err) {
        console.log("Detection error: %s", err)
        process.exit(1)
    }
    console.log("Detected language: %s", res.language)
  })

Tests

Gumshoe comes with tests. To run, simply execute npm test.

License

Gumshoe is released under a BSD license.

Credits

Picture of Legoman gumshoe CC-BY David Anderson from http://www.flickr.com/photos/venndiagram/5328211162/

gumshoe's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.