0

I have a gulp file using gulp-git that I wrote to assist our content writers in pushing their updates without having to use git command line. So basically it watches for changes in the given directories and then adds, commits, and pushes the changes.

The gulp file is this:

var gulp = require('gulp');
var git = require('gulp-git');
var runSequence = require('run-sequence');

gulp.task('add', function() {
    return gulp.src('./*')
    .pipe(git.add({args: '-A'}))
})

gulp.task('add-blog', function() {
    return gulp.src([
    './post',
    './properties',
    './files',
    './files'
  ])
    .pipe(git.add())
})

gulp.task('commit-blog', function() {
    return gulp.src([
    './post',
    './properties',
    './files'
  ])
    .pipe(git.commit('blog commit'))
})

gulp.task('push', function() {
    git.push('origin', function(err) {
        if (err) throw err;
    });
})

gulp.task('deploy', function(done) {
    runSequence('add-blog', 'commit-blog', 'push');
});

gulp.task('watch', function () {
    gulp.watch([
    './post/*',
    './properties/*',
    './files/*'
  ], ['deploy'])
});

then I run:

$nohup gulp watch &

it seems to run, but when I look at nohup out i see:

[16:12:37] Using gulpfile /var/www/html/respond/app/sites/ohio-cashflow/gulpfile.js
[16:12:37] Starting 'watch'...
[16:12:38] Finished 'watch' after 1.09 s

and it never runs the git commands when files are added or changed in the appropriate directories?

What am I missing here?

Pavel_K
  • 10,748
  • 13
  • 73
  • 186
Sandra Willford
  • 3,459
  • 11
  • 49
  • 96
  • That's what your log file should look like, until it runs again. Question: does gulp watch work (i.e. rebuild stuff) when it's not backgrounded? – Adam Jenkins Aug 15 '17 at 17:12
  • yes it works fine when not run in background. also when I make a change with the task in the background, it will make the add,commit,pull once, but as soon as I make another change it will not run again. – Sandra Willford Aug 15 '17 at 17:16

0 Answers0