Code Monkey home page Code Monkey logo

gulp-git-watch's Introduction

Gulp-Git-Watch

Gulp utility to constantly check Git for updates and trigger events when detected.

var gulp = require('gulp');
var gitWatch = require('gulp-git-watch');

gulp.task('git-watch', function() {
	gitWatch()
		.on('check', function() {
			console.log('CHECK!');
		})
		.on('change', function(newHash, oldHash) {
			console.log('CHANGES! FROM', oldHash, '->', newHash);
		});
});

Options

Option Default Description
poll 10 * 1000 - 10s How often gulp-git-watch should poll Git for changes
initialPoll 10 * 1000 - 10s How long gulp-git-watch should wait after the initial starting point to start polling
head null The initial Git HEAD value, if omitted it will be retrieved before polling
forceHead false Force always re-retrieving the current head state, only set this if other processes are likely to be triggering git pull events
gitHead git rev-list HEAD -n 1 The command to use to retrieve the current Git HEAD
gitPull git pull The command to use to instruct Git to pull in changes

Events

Event Description
check() Triggered when gulp-git-watch polls Git for changes
change(newHash, oldHash) Triggered when Git has updated from the old hash to a new hash
nochange(hash) Triggered when no Git changes were found

gulp-git-watch's People

Contributors

hash-bang avatar

Stargazers

Alexander Graham avatar Alexandru Olaru avatar Ilia Pavlov avatar  avatar Jan T. Sott avatar

Watchers

 avatar James Cloos avatar  avatar

gulp-git-watch's Issues

undefined settings.head = this.head[0]

Hi

I´m trying to use the plugin but it´s seems that this.command_response is never returned?

[14:08:38] Starting 'git-watch'...
[14:08:38] Finished 'git-watch' after 1.06 ms
CHECK!
..\node_modules\gulp-git-watch\index.js:33
                                                        settings.head = this.head[0];
TypeError: Cannot read property '0' of undefined

here is my gulpfile.js

var gulp = require('gulp');
var gitWatch = require('gulp-git-watch');

gulp.task('git-watch', function() {
    gitWatch({
        gitPull: ['git', 'pull', 'origin', 'master'],
        forceHead: true
    })
        .on('check', function() {
            console.log('CHECK!');
        })
        .on('change', function(newHash, oldHash) {
            console.log('CHANGES! FROM', oldHash, '->', newHash);
        });
});

You can se a repo also: https://bitbucket.org/agualbbus/git-watch-test/

Thanks for your time & help.

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.