Gulp file reorganized
This commit is contained in:
parent
87b3ac995d
commit
86830bc2d2
72
gulpfile.js
72
gulpfile.js
|
@ -59,6 +59,19 @@ gulp.task('run-services', ['nginx'], () => {
|
|||
});
|
||||
});
|
||||
|
||||
gulp.task('test', callback => {
|
||||
return require('./services_tests').start();
|
||||
});
|
||||
|
||||
gulp.task('e2e', callback => {
|
||||
runSequence('docker', 'waitForMySQL', 'run-e2e', callback);
|
||||
});
|
||||
|
||||
gulp.task('run-e2e', callback => {
|
||||
gulp.src('./e2e_tests.js')
|
||||
.pipe(jasmine({reporter: 'none'}));
|
||||
});
|
||||
|
||||
gulp.task('clean', function() {
|
||||
return del([`${buildDir}/*`, `!${buildDir}/templates`, `!${buildDir}/images`], {force: true});
|
||||
});
|
||||
|
@ -174,46 +187,8 @@ gulp.task('watch', function() {
|
|||
gulp.watch(localeFiles, ['locales']);
|
||||
});
|
||||
|
||||
// Services tests
|
||||
|
||||
gulp.task('test', callback => {
|
||||
return require('./services_tests').start();
|
||||
});
|
||||
|
||||
// E2E tests
|
||||
|
||||
gulp.task('e2e', callback => {
|
||||
runSequence('docker', 'waitForMySQL', 'run-e2e', callback);
|
||||
});
|
||||
|
||||
gulp.task('waitForMySQL', callback => {
|
||||
let maxInterval = 30000;
|
||||
let interval = 1000;
|
||||
let timer = 0;
|
||||
console.log('Waiting for MySQL init process...');
|
||||
let waitForLocaldb = setInterval(() => {
|
||||
if (timer < maxInterval) {
|
||||
timer += interval;
|
||||
exec('docker logs --tail 4 dblocal', (err, stdout, stderr) => {
|
||||
if (stdout.includes('MySQL init process done. Ready for start up.')) {
|
||||
clearInterval(waitForLocaldb);
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(`MySQL connection not established whithin ${maxInterval / 1000} secs!`);
|
||||
clearInterval(waitForLocaldb);
|
||||
}
|
||||
}, interval);
|
||||
});
|
||||
|
||||
gulp.task('run-e2e', callback => {
|
||||
gulp.src('./e2e_tests.js')
|
||||
.pipe(jasmine({reporter: 'none'}));
|
||||
});
|
||||
|
||||
// Docker
|
||||
|
||||
gulp.task('docker', callback => {
|
||||
runSequence('deleteDockerDb', 'deleteDockerImageDb', 'buildDockerDb', 'runDockerDb', callback);
|
||||
});
|
||||
|
@ -243,3 +218,24 @@ gulp.task('deleteDockerDb', callback => {
|
|||
callback(err = null);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('waitForMySQL', callback => {
|
||||
let maxInterval = 30000;
|
||||
let interval = 1000;
|
||||
let timer = 0;
|
||||
console.log('Waiting for MySQL init process...');
|
||||
let waitForLocaldb = setInterval(() => {
|
||||
if (timer < maxInterval) {
|
||||
timer += interval;
|
||||
exec('docker logs --tail 4 dblocal', (err, stdout, stderr) => {
|
||||
if (stdout.includes('MySQL init process done. Ready for start up.')) {
|
||||
clearInterval(waitForLocaldb);
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(`MySQL connection not established whithin ${maxInterval / 1000} secs!`);
|
||||
clearInterval(waitForLocaldb);
|
||||
}
|
||||
}, interval);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue