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
npm-debug.log
debug.log
datasources.test.json
datasources.development.json
.idea
.idea

View File

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

View File

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

View File

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