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?