Development environment now points to local database by default

This commit is contained in:
Juan Ferrer Toribio 2018-01-31 14:56:55 +01:00
parent 9090c56c64
commit 87b3ac995d
4 changed files with 21 additions and 30 deletions

2
.gitignore vendored
View File

@ -3,5 +3,7 @@ node_modules
build build
npm-debug.log npm-debug.log
debug.log debug.log
datasources.test.json
datasources.development.json datasources.development.json
.idea .idea
.idea

View File

@ -29,18 +29,26 @@ gulp.task('default', () => {
return gulp.start('services', 'client'); return gulp.start('services', 'client');
}); });
gulp.task('build', ['clean'], () => {
return gulp.start('routes', 'locales', 'webpack');
});
gulp.task('client', ['clean'], () => { gulp.task('client', ['clean'], () => {
return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server'); return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server');
}); });
gulp.task('services', ['nginx'], () => { gulp.task('services', callback => {
if (gutil.env.env && !process.env.NODE_ENV) let isWindows = /^win/.test(process.platform);
process.env.NODE_ENV = gutil.env.env; let command = isWindows ? 'docker inspect dblocal | findstr Status' : 'docker inspect dblocal | grep Status';
exec(command, (err, stdout, stderr) => {
let isNotRunning = !stdout.includes('running');
if (isNotRunning) {
runSequence('docker', 'waitForMySQL', 'run-services');
} else {
runSequence('run-services');
}
callback(err);
});
});
gulp.task('run-services', ['nginx'], () => {
const servicesPath = './services/'; const servicesPath = './services/';
const services = fs.readdirSync(servicesPath); const services = fs.readdirSync(servicesPath);
services.splice(services.indexOf('loopback'), 1); services.splice(services.indexOf('loopback'), 1);
@ -72,19 +80,8 @@ gulp.task('install', () => {
})); }));
}); });
gulp.task('servicesDev', callback => { gulp.task('build', ['clean'], () => {
let isWindows = /^win/.test(process.platform); return gulp.start('routes', 'locales', 'webpack');
let command = isWindows ? 'docker inspect dblocal | findstr Status' : 'docker inspect dblocal | grep Status';
gutil.env.env = 'test';
exec(command, (err, stdout, stderr) => {
let isNotRunning = !stdout.includes('running');
if (isNotRunning) {
runSequence('docker', 'waitForMySQL', 'services');
} else {
runSequence('services');
}
callback(err);
});
}); });
// Nginx // Nginx
@ -186,7 +183,7 @@ gulp.task('test', callback => {
// E2E tests // E2E tests
gulp.task('e2e', callback => { gulp.task('e2e', callback => {
runSequence('docker', 'waitForMySQL', 'endToEndTests', callback); runSequence('docker', 'waitForMySQL', 'run-e2e', callback);
}); });
gulp.task('waitForMySQL', callback => { gulp.task('waitForMySQL', callback => {
@ -210,7 +207,7 @@ gulp.task('waitForMySQL', callback => {
}, interval); }, interval);
}); });
gulp.task('endToEndTests', callback => { gulp.task('run-e2e', callback => {
gulp.src('./e2e_tests.js') gulp.src('./e2e_tests.js')
.pipe(jasmine({reporter: 'none'})); .pipe(jasmine({reporter: 'none'}));
}); });

View File

@ -1,5 +1 @@
node_modules node_modules
config.json
app.development.json
smtp.development.json
mysql.development.json

View File

@ -1,5 +1 @@
node_modules node_modules
config.json
app.development.json
smtp.development.json
mysql.development.json