This commit is contained in:
jonathan Quispe
2017-09-15 11:54:39 +00:00
committed by Paula Quispe
parent 94d9fb2b3d
commit 4a9c1b2d39
10 changed files with 340 additions and 181 deletions

View File

@@ -471,6 +471,37 @@ gulp.task('clean', function () {
cleanDirectory('workflow/public_html/lib');
});
/**
* Exports from the config/constants.php the configuration constants to the
* enviromentvariables.json file
*/
gulp.task('exportBackendConstants', function () {
var runner = require('child_process');
gutil.log(gutil.colors.green('Export ProcessMaker constants...'));
var envVarsJsonFile = 'config/enviromentvariables.json';
var code = 'require_once "gulliver/system/class.g.php";' +
'require_once "bootstrap/autoload.php";' +
'require_once "bootstrap/app.php";' +
'app()->make(Illuminate\\Foundation\\Http\\Kernel::class)->bootstrap();' +
'print(json_encode(config("constants", JSON_UNESCAPED_SLASHES)));';
runner.exec(
'php -r \'' + code + '\'',
function (err, stdout, stderr) {
var pmConstants = JSON.parse(stdout);
var envVar = JSON.parse(fs.readFileSync(envVarsJsonFile));
for (var attr in pmConstants) {
envVar[attr] = pmConstants[attr];
}
fs.writeFileSync(envVarsJsonFile, JSON.stringify(envVar, null, 2));
return pmConstants;
});
});
/**
* This scheduled task is to be able to create the guest user constants
*/
@@ -490,7 +521,7 @@ gulp.task('__env', function (cb) {
);
});
gulp.task('default', ['clean', '__env'], function (cb) {
gulp.task('default', ['clean', 'exportBackendConstants', '__env'], function (cb) {
var i, tasks = [];
gutil.log(gutil.colors.green('Initializing ProcessMaker building...'));
@@ -499,4 +530,5 @@ gulp.task('default', ['clean', '__env'], function (cb) {
tasks.push(_.bind(processTask, config[i]));
}
executeSequence(tasks, cb);
});
});