Skip to content

Commit ed174a3

Browse files
authored
Merge pull request #23 from xgeek-net/fix/gitdeploy
Fixed bugs
2 parents f0ba353 + 9e0a8af commit ed174a3

File tree

6 files changed

+26
-9
lines changed

6 files changed

+26
-9
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pipeline",
33
"description": "Be less busy, less mistake in Salesforce metadata deploy",
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"private": false,
66
"main": "src/main.js",
77
"dependencies": {
@@ -16,7 +16,7 @@
1616
"github-api": "^3.2.0",
1717
"jsforce": "^1.9.1",
1818
"moment": "^2.24.0",
19-
"nodegit": "^0.24.3",
19+
"nodegit": "^0.25.0",
2020
"querystring": "^0.2.0",
2121
"raven": "^2.6.4",
2222
"request": "^2.88.0",

src/class/GitApi.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ class GitApi {
288288
let fileName = patchPath;
289289
if(rootDir) fileName = fileName.replace(path.join(rootDir, '/'), '');
290290
let filePath = metadata.makeDir(self.pipeline.id, fileName);
291-
if(utils.isBlank(fileName) || !fileName.startsWith('src/') || self.cacheFiles.indexOf(fileName) >= 0) {
291+
if(utils.isBlank(fileName) ||
292+
(!fileName.startsWith('src/') && fileName != 'src/package.xml') ||
293+
self.cacheFiles.indexOf(fileName) >= 0) {
292294
self.logger(' > ' + patchPath + ' (Ignored)');
293295
return callback(null);
294296
}

src/class/GithubApi.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,17 @@ class GithubApi {
342342
fileNameOnly = utils.getFileName(fileNameOnly);
343343

344344
// ignore blank file, file out of src folder, cached file
345-
if(utils.isBlank(fileNameOnly) || utils.isBlank(filedir) || !filedir.startsWith('src/') || self.cacheFiles.indexOf(fileName) >= 0) {
345+
if(utils.isBlank(fileNameOnly) || utils.isBlank(filedir) ||
346+
(!filedir.startsWith('src/') && fileName != 'src/package.xml') ||
347+
self.cacheFiles.indexOf(fileName) >= 0) {
346348
self.logger(' > ' + file.path + ' (Ignored)');
347349
return callback(null);
348350
}
349351
self.cacheFiles.push(fileName);
350-
351352
const localPath = metadata.makeDir(self.pipeline.id, fileName)
352-
const fileContentUri = path.join('repos', repos.__fullname, 'contents', file.path);
353+
const filePath = file.path.replace(new RegExp(fileNameOnly,'g'), encodeURIComponent(fileNameOnly));
354+
const fileContentUri = path.join('repos', repos.__fullname, 'contents', filePath);
355+
353356
self.fileApiCall(fileContentUri, { ref : branchName })
354357
.then(function(response) {
355358
if(utils.isBlank(response.status) || response.status != 200) {
@@ -429,7 +432,9 @@ class GithubApi {
429432
let filedir = path.dirname(fileName);
430433
fileNameOnly = utils.getFileName(fileNameOnly);
431434
// ignore blank file, file out of src folder, cached file
432-
if(utils.isBlank(fileNameOnly) || utils.isBlank(filedir) || !filedir.startsWith('src/') || self.cacheFiles.indexOf(fileName) >= 0) {
435+
if(utils.isBlank(fileNameOnly) || utils.isBlank(filedir) ||
436+
(!filedir.startsWith('src/') && fileName != 'src/package.xml') ||
437+
self.cacheFiles.indexOf(fileName) >= 0) {
433438
self.logger(' > ' + file.filename + ' (Ignored)');
434439
return callback(null);
435440
}

src/class/Metadata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Metadata {
9999
createPackageXml(targetPath, opts) {
100100
opts = opts || {};
101101
const metaPath = path.join(targetPath, 'metadata', 'src');
102-
if(fse.pathExistsSync(metaPath + '/package.xml')) {
102+
if(fse.pathExistsSync(path.join(metaPath, 'package.xml'))) {
103103
return true;
104104
}
105105
return sgp({

src/class/Pipeline.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ class Pipeline {
428428

429429
const getStatus = function(cmp) {
430430
let status = 'No Change';
431+
if(!cmp) return status;
431432
if(cmp.changed == 'true') status = 'Updated';
432433
if(cmp.created == 'true') status = 'Created';
433434
if(cmp.deleted == 'true') status = 'Deleted';
@@ -452,7 +453,7 @@ class Pipeline {
452453
if(utils.isBlank(componentType)) continue;
453454
if(!componentLables.hasOwnProperty(componentType)) continue;
454455
deployResult.details.componentFailures[i]['componentTypeLabel'] = componentLables[componentType];
455-
deployResult.details.componentSuccesses[i]['status'] = getStatus(deployResult.details.componentSuccesses[i]);
456+
deployResult.details.componentFailures[i]['status'] = getStatus(deployResult.details.componentFailures[i]);
456457
}
457458
}
458459
fs.writeFileSync(filePath, JSON.stringify(deployResult));

src/class/SfdcApi.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,12 @@ class SfdcApi {
403403
case 'Role' :
404404
// Needs requestMetaLabel
405405
break;
406+
case 'Profile' :
407+
resetFunction = function(meta) {
408+
meta['customName'] = decodeURIComponent(meta.fullName);
409+
return meta;
410+
};
411+
break;
406412
default :
407413
break;
408414
}
@@ -536,6 +542,9 @@ class SfdcApi {
536542
}
537543
if(child.typeName == 'WorkflowAlert' && cMeta.description) cMeta['customName'] = cMeta.description;
538544
if(child.typeName == 'WorkflowFieldUpdate' && cMeta.name) cMeta['customName'] = cMeta.name;
545+
// URI Decode Japanese
546+
if(child.typeName == 'WorkflowRule' && !cMeta.customName) cMeta['customName'] = decodeURIComponent(cMeta.fullName);
547+
if(child.typeName == 'BusinessProcess' && !cMeta.customName) cMeta['customName'] = decodeURIComponent(cMeta.fullName);
539548

540549
metadataMap[child.typeName].push(cMeta);
541550
}

0 commit comments

Comments
 (0)