Git Product home page Git Product logo

git-tasker's Introduction

git-execute

Execute scripts when various file types have been updated in GIT. Specifically this script is used at Beanstalk within a git hook to conditionally run npm install and a gulp build when frontend files have changed. It is used in conjuction with http://stackoverflow.com/questions/3462955/putting-git-hooks-into-repository/3464399#3464399

Example configuration within package.json

Install with npm install -g git-tasker

By default, git-tasker will execute git diff --name-only HEAD@{1} HEAD to determine which files have changed. Each file is matched against a matcher within the below json. If it matches, the command will be queued for execution. Duplicate commands will only be queued once and are queued in the order they are defined. In the below example, the npm install command will always be executed before the gulp build.

{
  "name": "example",
  "dependencies": [],
  "git-tasker": [
    {
      "matcher": "package.json",
      "command": "npm install"
    },
    {
      "matcher": "**/*.js",
      "command": "gulp build"
    }
  ]
}

API Usage

Install with npm install git-tasker

var git_tasker = require('git-tasker');
/**
 * @param config - a configuration array, same as the above config in package.json
 * @param git_list_command - optional string command for listing files changed. Defaults to `git diff --name-only HEAD@{1} HEAD`
 * @param callback - A final callback when all tasks/commands have been executed
 */
git_tasker(config, git_list_command, callback);

git-tasker's People

Contributors

blittle avatar casperson avatar greenkeeperio-bot avatar

Stargazers

 avatar

Watchers

 avatar Oli I avatar Tony Lefler avatar Kurt avatar Patrick Cox avatar Leah McBeth avatar Jin avatar  avatar Landon Young avatar Anthony Frehner avatar Jonathan Willis avatar Ben Porter avatar Carlos Filoteo avatar Jesse Plumb avatar  avatar Joel Denning avatar  avatar Keith Halterman avatar  avatar Marcus Tanner avatar Rod Gilbert avatar Daniel Kesler avatar Michael Memory avatar Ren Miao avatar Jared Mackey avatar Mike Bordelon avatar Seth Dickson avatar  avatar  avatar  avatar Devon Moss avatar Vignya avatar  avatar

Forkers

kreo

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.