This commit is contained in:
yuri
2019-05-01 12:17:11 +03:00
parent e1eb3f804e
commit 942726eb74
+17 -8
View File
@@ -57,10 +57,8 @@ var currentPath = path.dirname(fs.realpathSync(__filename));
var buildRelPath = 'build/EspoCRM-' + version;
var buildPath = currentPath + '/' + buildRelPath;
var diffFilePath = currentPath + '/build/diff';
var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + acceptedVersionName + '-to-' + version;
var exec = require('child_process').exec;
function execute(command, callback) {
@@ -69,6 +67,23 @@ function execute(command, callback) {
});
};
var deleteDirRecursively = function (path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function(file, index) {
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) {
deleteDirRecursively(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
};
deleteDirRecursively(diffFilePath);
deleteDirRecursively(upgradePath);
execute('git diff --name-only ' + versionFrom, function (stdout) {
if (!fs.existsSync(upgradePath)) {
fs.mkdirSync(upgradePath);
@@ -149,15 +164,9 @@ execute('git diff --name-only ' + versionFrom, function (stdout) {
}
fs.writeFileSync(upgradePath + '/manifest.json', JSON.stringify(manifest, null, ' '));
});
fs.unlinkSync(diffFilePath);
});
});
});