Add gulp "pre-commit" command.

This commit is contained in:
Christopher Charbonneau Wells 2018-10-11 19:30:11 -07:00
parent 77bf37df33
commit 2b6fdf327f
1 changed files with 23 additions and 1 deletions

View File

@ -132,7 +132,21 @@ gulp.task('coverage', coverage);
gulp.task('collectstatic', function(cb) { gulp.task('collectstatic', function(cb) {
var command = ['run', 'python', 'manage.py', 'collectstatic']; var command = ['run', 'python', 'manage.py', 'collectstatic'];
command = command.concat(process.argv.splice(3));
/* Use base settings if no settings parameter is supplied. */
var parameters = process.argv.splice(3);
var noSettings = true;
for (var i = 0; i < parameters.length; i++) {
if (parameters[i].substring(0, 10) === '--settings') {
noSettings = false;
break;
}
}
if (noSettings) {
parameters.push('--settings=babybuddy.settings.base');
}
command = command.concat(parameters);
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb); spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
}); });
@ -179,6 +193,14 @@ function clean() {
gulp.task('clean', clean); gulp.task('clean', clean);
gulp.task('pre-commit', gulp.series(
'lint',
'test',
'clean',
'build',
'collectstatic'
));
gulp.task('runserver', function(cb) { gulp.task('runserver', function(cb) {
var command = ['run', 'python', 'manage.py', 'runserver']; var command = ['run', 'python', 'manage.py', 'runserver'];
command = command.concat(process.argv.splice(3)); command = command.concat(process.argv.splice(3));