ES6 variables; code style

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 8 years ago
parent 1a9dfc7263
commit d058d8f93e
  1. 23
      BuildServer/app.js
  2. 67
      BuildServer/lib/builder.js
  3. 49
      BuildServer/lib/commenter.js
  4. 23
      BuildServer/lib/git/copy.js
  5. 30
      BuildServer/lib/git/loader.js
  6. 7
      BuildServer/lib/mail-sender.js
  7. 29
      BuildServer/lib/status-processor.js
  8. 124
      BuildServer/lib/task-processor.js
  9. 5
      BuildServer/lib/tasks/cleanupafterdotnetbuild.js
  10. 4
      BuildServer/lib/tasks/conditional.js
  11. 6
      BuildServer/lib/tasks/copy.js
  12. 3
      BuildServer/lib/tasks/copyglob.js
  13. 2
      BuildServer/lib/tasks/deletefromcode.js
  14. 2
      BuildServer/lib/tasks/dotnetbuild.js
  15. 3
      BuildServer/lib/tasks/dotnetbuildandtest.js
  16. 34
      BuildServer/lib/tasks/dotnetbuilderwrapper.js
  17. 4
      BuildServer/lib/tasks/dotnetbuildwithoutcleanup.js
  18. 8
      BuildServer/lib/tasks/dotnetcheckstyle.js
  19. 8
      BuildServer/lib/tasks/dotnetcompile.js
  20. 7
      BuildServer/lib/tasks/dotnetnugetpack.js
  21. 42
      BuildServer/lib/tasks/dotnetnugetprocess.js
  22. 9
      BuildServer/lib/tasks/dotnetnugetpush.js
  23. 5
      BuildServer/lib/tasks/dotnetnugetpushonly.js
  24. 2
      BuildServer/lib/tasks/dotnetnugetrestore.js
  25. 2
      BuildServer/lib/tasks/dotnetnunit.js
  26. 5
      BuildServer/lib/tasks/dotnetnunitall.js
  27. 13
      BuildServer/lib/tasks/dotnetpackwebapp.js
  28. 27
      BuildServer/lib/tasks/dotnetrewrite.js
  29. 6
      BuildServer/lib/tasks/parallel.js
  30. 4
      BuildServer/lib/tasks/sequential.js
  31. 6
      BuildServer/lib/tasks/writefile.js
  32. 2
      BuildServer/routes/artifact.js
  33. 7
      BuildServer/routes/index.js
  34. 4
      BuildServer/routes/manual.js
  35. 104
      BuildServer/routes/postreceive.js
  36. 34
      BuildServer/routes/release.js
  37. 27
      BuildServer/routes/status.js

@ -1,19 +1,16 @@
"use strict";
/** //const https = require('https');
* Module dependencies. const realFs = require('fs');
*/ const fs = require('graceful-fs');
var https = require('https');
var realFs = require('fs');
var fs = require('graceful-fs');
fs.gracefulify(realFs); fs.gracefulify(realFs);
var express = require('express'); const express = require('express');
var routes = require('./routes'); const routes = require('./routes');
var http = require('http'); const http = require('http');
var path = require('path'); const path = require('path');
var app = express(); const app = express();
// all environments // all environments
app.set('port', process.env.PORT || 3000); app.set('port', process.env.PORT || 3000);
@ -31,7 +28,7 @@ app.use(app.router);
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
// development only // development only
if ('development' == app.get('env')) { if ('development' === app.get('env')) {
app.use(express.errorHandler()); app.use(express.errorHandler());
} }

@ -1,18 +1,18 @@
"use strict"; "use strict";
var fs = require('fs'); const fs = require('fs');
var fse = require('fs-extra'); const fse = require('fs-extra');
var async = require('async'); const async = require('async');
var gitLoader = require('./git/loader'); const gitLoader = require('./git/loader');
var processor = require('./task-processor'); const processor = require('./task-processor');
var mailSender = require('./mail-sender'); const mailSender = require('./mail-sender');
var settings = require('../settings'); const settings = require('../settings');
//var codePostfix = "/code"; //const codePostfix = "/code";
var codePostfix = ""; const codePostfix = "";
var notifyStatus = function (options, callback) { const notifyStatus = function (options, callback) {
var status = { const status = {
user: options.owner, user: options.owner,
repo: options.reponame, repo: options.reponame,
sha: options.hash, sha: options.hash,
@ -30,21 +30,21 @@ var notifyStatus = function (options, callback) {
}); });
}; };
var build = function (options, callback) { const build = function (options, callback) {
var url = options.url, const url = options.url;
owner = options.owner, const owner = options.owner;
reponame = options.reponame, const reponame = options.reponame;
rev = options.rev, const rev = options.rev;
branch = options.branch, const branch = options.branch;
skipGitLoader = options.skipGitLoader, const skipGitLoader = options.skipGitLoader;
local = options.app.get('gitpath') + "/r/", const local = options.app.get('gitpath') + "/r/";
tmp = options.app.get('tmpcodepath') + "/" + rev.substr(0, 15), const tmp = options.app.get('tmpcodepath') + "/" + rev.substr(0, 15);
exported = tmp + codePostfix, const exported = tmp + codePostfix;
release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev, const release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev;
statusQueue = async.queue(function (task, callback) { const statusQueue = async.queue(function (task, callback) {
task(callback); task(callback);
}, 1), }, 1);
actualGitLoader = skipGitLoader ? function(options, callback) { process.nextTick(callback); } : gitLoader; const actualGitLoader = skipGitLoader ? function(options, callback) { process.nextTick(callback); } : gitLoader;
statusQueue.push(function (callback) { statusQueue.push(function (callback) {
notifyStatus({ notifyStatus({
@ -62,10 +62,10 @@ var build = function (options, callback) {
fse.mkdirsSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs"); fse.mkdirsSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs");
fs.writeFileSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs/" + rev + ".branch", branch); fs.writeFileSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs/" + rev + ".branch", branch);
var done = function (err, result) { const done = function (err, result) {
var errorMessage = result && result.errors ? ((result.errors.$allMessages || [])[0] || {}).message : err, const errorMessage = result && result.errors ? ((result.errors.$allMessages || [])[0] || {}).message : err;
warnMessage = result && result.warns ? ((result.warns.$allMessages || [])[0] || {}).message : err, const warnMessage = result && result.warns ? ((result.warns.$allMessages || [])[0] || {}).message : err;
infoMessage = result && result.infos ? ((result.infos.$allMessages || []).slice(-1)[0] || {}).message : err; const infoMessage = result && result.infos ? ((result.infos.$allMessages || []).slice(-1)[0] || {}).message : err;
fs.writeFile(release + "/report.json", JSON.stringify({date: Date.now(), err: err, result: result}), function (writeErr) { fs.writeFile(release + "/report.json", JSON.stringify({date: Date.now(), err: err, result: result}), function (writeErr) {
statusQueue.push(function (callback) { statusQueue.push(function (callback) {
@ -80,7 +80,6 @@ var build = function (options, callback) {
}, callback); }, callback);
}, },
function (callback) { function (callback) {
return process.nextTick(callback);
mailSender.send({ mailSender.send({
from: settings.smtp.sender, from: settings.smtp.sender,
to: settings.smtp.receiver, to: settings.smtp.receiver,
@ -131,7 +130,7 @@ var build = function (options, callback) {
return done(err, "MBSUnableToRead"); return done(err, "MBSUnableToRead");
} }
var task; let task;
try { try {
task = JSON.parse(data); task = JSON.parse(data);
} catch(ex) { } catch(ex) {

@ -1,15 +1,14 @@
"use strict"; "use strict";
var fs = require('fs'), const fs = require('fs');
_ = require('underscore'), const _ = require('underscore');
builder = require('../lib/builder'), const settings = require('../settings');
settings = require('../settings');
var featureNamePattern = /^feature-(\d+)(?:-[a-zA-Z0-9]+)+$/; const featureNamePattern = /^feature-(\d+)(?:-[a-zA-Z0-9]+)+$/;
var versionNamePattern = /^v\d+(\.\d+)*$/; const versionNamePattern = /^v\d+(\.\d+)*$/;
var masterNamePattern = /^master$/; const masterNamePattern = /^master$/;
var writeComment = function (options, message, callback) { const writeComment = function (options, message, callback) {
return options.github.issues.createComment({ return options.github.issues.createComment({
user: options.baseRepoOptions.owner, user: options.baseRepoOptions.owner,
repo: options.baseRepoOptions.reponame, repo: options.baseRepoOptions.reponame,
@ -18,7 +17,7 @@ var writeComment = function (options, message, callback) {
}, callback); }, callback);
}; };
var closePullRequest = function (options, message, callback) { const closePullRequest = function (options, message, callback) {
return writeComment(options, message, function (err) { return writeComment(options, message, function (err) {
if (err) { if (err) {
return callback(err); return callback(err);
@ -33,7 +32,7 @@ var closePullRequest = function (options, message, callback) {
}); });
}; };
var checkHasIssue = function (options, issueNumber, callback) { const checkHasIssue = function (options, issueNumber, callback) {
return options.github.issues.getRepoIssue({ return options.github.issues.getRepoIssue({
user: options.baseRepoOptions.owner, user: options.baseRepoOptions.owner,
repo: options.baseRepoOptions.reponame, repo: options.baseRepoOptions.reponame,
@ -55,7 +54,7 @@ var checkHasIssue = function (options, issueNumber, callback) {
}); });
}; };
var checkHasReleases = function (options, callback) { const checkHasReleases = function (options, callback) {
return options.github.releases.listReleases({ return options.github.releases.listReleases({
owner: options.baseRepoOptions.owner, owner: options.baseRepoOptions.owner,
repo: options.baseRepoOptions.reponame, repo: options.baseRepoOptions.reponame,
@ -69,9 +68,9 @@ var checkHasReleases = function (options, callback) {
}); });
}; };
var checkPullRequest = function (options, callback) { const checkPullRequest = function (options, callback) {
var head = options.headRepoOptions, const head = options.headRepoOptions;
base = options.baseRepoOptions; const base = options.baseRepoOptions;
if (head.reponame !== base.reponame) { if (head.reponame !== base.reponame) {
return closePullRequest(options, "Base and head repository names should match", callback); return closePullRequest(options, "Base and head repository names should match", callback);
@ -107,7 +106,7 @@ var checkPullRequest = function (options, callback) {
return closePullRequest(options, "Only merging to master or version branch is allowed; merging to '" + base.branchname + "' is not supported", callback); return closePullRequest(options, "Only merging to master or version branch is allowed; merging to '" + base.branchname + "' is not supported", callback);
} }
var issueNumber = featureNamePattern.exec(head.branchname)[1]; const issueNumber = featureNamePattern.exec(head.branchname)[1];
return checkHasIssue(options, issueNumber, function (err, hasIssue, issueTitle) { return checkHasIssue(options, issueNumber, function (err, hasIssue, issueTitle) {
if (err) { if (err) {
return writeComment(options, "Unable to check for issue:\r\n\r\n" + err.message, callback); return writeComment(options, "Unable to check for issue:\r\n\r\n" + err.message, callback);
@ -117,7 +116,7 @@ var checkPullRequest = function (options, callback) {
return closePullRequest(options, "Unable to find issue #" + issueNumber, callback); return closePullRequest(options, "Unable to find issue #" + issueNumber, callback);
} }
var shouldHaveReleases = versionNamePattern.test(base.branchname); const shouldHaveReleases = versionNamePattern.test(base.branchname);
return checkHasReleases(options, function (err, hasReleases) { return checkHasReleases(options, function (err, hasReleases) {
if (err) { if (err) {
return writeComment(options, "Unable to check for releases", callback); return writeComment(options, "Unable to check for releases", callback);
@ -140,9 +139,9 @@ var checkPullRequest = function (options, callback) {
}); });
}; };
var getStatusMessageFromRelease = function (app, options, callback) { const getStatusMessageFromRelease = function (app, options, callback) {
var releaseDir = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev, const releaseDir = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev;
reportFile = releaseDir + "/report.json"; const reportFile = releaseDir + "/report.json";
options.attemptsGetReport = (options.attemptsGetReport || 0) + 1; options.attemptsGetReport = (options.attemptsGetReport || 0) + 1;
@ -168,20 +167,20 @@ var getStatusMessageFromRelease = function (app, options, callback) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
var data = dataBuffer.toString(); const data = dataBuffer.toString();
if (!data) { if (!data) {
return callback("Report file not found"); return callback("Report file not found");
} }
var report = JSON.parse(data); const report = JSON.parse(data);
if (report.result === "MBSNotFound") { if (report.result === "MBSNotFound") {
return callback("mbs.json is not found"); return callback("mbs.json is not found");
} }
if (report.result && ((report.result.errors || {}).$allMessages || []).length + ((report.result.warns || {}).$allMessages || []).length > 0) { if (report.result && ((report.result.errors || {}).$allMessages || []).length + ((report.result.warns || {}).$allMessages || []).length > 0) {
return callback(_.map( return callback(_.map(
(report.result.errors || {}).$allMessages || [], function(message) { return "ERR: " + message.message } (report.result.errors || {}).$allMessages || [], function(message) { return "ERR: " + message.message; }
).concat(_.map( ).concat(_.map(
(report.result.warns || {}).$allMessages || [], function(message) { return "WARN: " + message.message } (report.result.warns || {}).$allMessages || [], function(message) { return "WARN: " + message.message; }
)).join("\r\n")); )).join("\r\n"));
} }
if (!report.result || report.err) { if (!report.result || report.err) {
@ -200,8 +199,8 @@ exports.commentOnPullRequest = function (options, callback) {
options.github = settings.createGithub(options.baseRepoOptions.owner); options.github = settings.createGithub(options.baseRepoOptions.owner);
return checkPullRequest(options, function (err, successMessage) { return checkPullRequest(options, function (err, successMessage) {
getStatusMessageFromRelease(options.app, options.headRepoOptions, function (err, successMessage) { getStatusMessageFromRelease(options.app, options.headRepoOptions, function (err, successMessage) {
var message = err ? ("Was not built:\r\n\r\n```\r\n" + err.replace(/```/g, '` ` `') + "\r\n```\r\n\r\nDO NOT MERGE!") : ("Build OK\r\n\r\n" + successMessage), const message = err ? ("Was not built:\r\n\r\n```\r\n" + err.replace(/```/g, '` ` `') + "\r\n```\r\n\r\nDO NOT MERGE!") : ("Build OK\r\n\r\n" + successMessage);
statusUrlMessage = "Build status URL: " + settings.siteRoot + "status/" + options.headRepoOptions.owner + "/" + options.headRepoOptions.reponame + "/" + options.headRepoOptions.rev + "\r\n\r\n"; const statusUrlMessage = "Build status URL: " + settings.siteRoot + "status/" + options.headRepoOptions.owner + "/" + options.headRepoOptions.reponame + "/" + options.headRepoOptions.rev + "\r\n\r\n";
return writeComment(options, message + "\r\n\r\n" + statusUrlMessage, callback); return writeComment(options, message + "\r\n\r\n" + statusUrlMessage, callback);
}); });
}); });

@ -1,18 +1,17 @@
"use strict"; "use strict";
var EventEmitter = require('events').EventEmitter, const EventEmitter = require('events').EventEmitter;
path = require('path'), const path = require('path');
fs = require('fs'), const fs = require('fs');
nodegit = require('nodegit'), const async = require('async');
async = require('async'), const Copier = require('recursive-tree-copy').Copier;
Copier = require('recursive-tree-copy').Copier;
var gitToFsCopier = new Copier({ const gitToFsCopier = new Copier({
concurrency: 4, concurrency: 4,
walkSourceTree: function (tree) { walkSourceTree: function (tree) {
var emitter = new EventEmitter(); const emitter = new EventEmitter();
process.nextTick(function () { process.nextTick(function () {
var entries; let entries;
try { try {
entries = tree.gitTree.entries(); entries = tree.gitTree.entries();
} catch(err) { } catch(err) {
@ -48,9 +47,9 @@ var gitToFsCopier = new Copier({
return emitter; return emitter;
}, },
createTargetTree: function (tree, targetDir, callback) { createTargetTree: function (tree, targetDir, callback) {
var targetSubdir = path.join(targetDir, tree.name); const targetSubdir = path.join(targetDir, tree.name);
fs.mkdir(targetSubdir, function (err) { fs.mkdir(targetSubdir, function (err) {
if (err && err.code != 'EEXIST' /* workaround for broken trees */) { if (err && err.code !== 'EEXIST' /* workaround for broken trees */) {
return callback(err); return callback(err);
} }
@ -61,7 +60,7 @@ var gitToFsCopier = new Copier({
callback(); callback();
}, },
copyLeaf: function (entry, targetDir, callback) { copyLeaf: function (entry, targetDir, callback) {
var targetPath = path.join(targetDir, entry.name()); const targetPath = path.join(targetDir, entry.name());
entry.getBlob(function (err, blob) { entry.getBlob(function (err, blob) {
if (err) { if (err) {
return callback(err); return callback(err);

@ -1,16 +1,16 @@
"use strict"; "use strict";
var nodegit = require('nodegit'), const nodegit = require('nodegit');
fse = require('fs-extra'), const fse = require('fs-extra');
gitToFs = require('./copy').gitToFs, const gitToFs = require('./copy').gitToFs;
mkdirs = function (path) { const mkdirs = function (path) {
/*jslint stupid: true */ /*jslint stupid: true */
fse.mkdirsSync(path); fse.mkdirsSync(path);
}, };
removedirs = function (path) { const removedirs = function (path) {
/*jslint stupid: true */ /*jslint stupid: true */
fse.removeSync(path); fse.removeSync(path);
}; };
/* /*
options = { options = {
@ -23,14 +23,14 @@ options = {
*/ */
module.exports = function (options, globalCallback) { module.exports = function (options, globalCallback) {
var url = options.remote, let url = options.remote;
path = options.local + "/" + options.hash, const path = options.local + "/" + options.hash;
exported = options.exported; const exported = options.exported;
removedirs(path); removedirs(path);
mkdirs(path); mkdirs(path);
if (url.substr(0, 8) == "https://") { if (url.substr(0, 8) === "https://") {
url = "git://" + url.substr(8); url = "git://" + url.substr(8);
} }

@ -1,12 +1,15 @@
"use strict"; "use strict";
var nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
var settings = require('../settings'); const settings = require('../settings');
exports.send = function (message, callback) { exports.send = function (message, callback) {
return process.nextTick(callback);
/*
var transport = nodemailer.createTransport("SMTP", settings.smtp); var transport = nodemailer.createTransport("SMTP", settings.smtp);
transport.sendMail(message, function(err, result) { transport.sendMail(message, function(err, result) {
transport.close(); transport.close();
callback(err, result); callback(err, result);
}); });
*/
}; };

@ -1,11 +1,10 @@
"use strict"; "use strict";
var fs = require('fs'), const fs = require('fs');
url = require('url'), const glob = require('glob');
glob = require('glob');
var addBranchInfo = function (app, options, callback) { const addBranchInfo = function (app, options, callback) {
var branchFile = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/$revs/" + options.rev + ".branch"; const branchFile = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/$revs/" + options.rev + ".branch";
fs.exists(branchFile, function (exists) { fs.exists(branchFile, function (exists) {
if (!exists) { if (!exists) {
return callback("BranchFileNotFound", options); return callback("BranchFileNotFound", options);
@ -21,8 +20,8 @@ var addBranchInfo = function (app, options, callback) {
}); });
}; };
var addRevInfo = function (app, options, callback) { const addRevInfo = function (app, options, callback) {
var revFile = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/latest.id"; const revFile = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/latest.id";
fs.exists(revFile, function (exists) { fs.exists(revFile, function (exists) {
if (!exists) { if (!exists) {
return callback("RevFileNotFound", options); return callback("RevFileNotFound", options);
@ -37,13 +36,13 @@ var addRevInfo = function (app, options, callback) {
}); });
}; };
var parseOptions = function (app, options, callback) { const parseOptions = function (app, options, callback) {
var result = {}; const result = {};
result.owner = options.owner; result.owner = options.owner;
result.reponame = options.reponame; result.reponame = options.reponame;
if (options.rev && !/^[\da-f]{40}$/i.test(options.rev)) { if (options.rev && !(/^[\da-f]{40}$/i).test(options.rev)) {
return callback("Wrong rev format: " + options.rev, options); return callback("Wrong rev format: " + options.rev, options);
} }
@ -60,15 +59,15 @@ var parseOptions = function (app, options, callback) {
} }
}; };
var loadReport = function (app, options, callback) { const loadReport = function (app, options, callback) {
var releaseDir = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev; const releaseDir = app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev;
glob("**", {cwd: releaseDir, mark: true}, function (err, files) { glob("**", {cwd: releaseDir, mark: true}, function (err, files) {
if (err) { if (err) {
return callback(err, options); return callback(err, options);
} }
var reportFile = releaseDir + "/report.json"; const reportFile = releaseDir + "/report.json";
options.files = files; options.files = files;
fs.exists(reportFile, function (exists) { fs.exists(reportFile, function (exists) {
if (!exists) { if (!exists) {
@ -79,7 +78,7 @@ var loadReport = function (app, options, callback) {
if (err) { if (err) {
return callback(err, options); return callback(err, options);
} }
var data = dataBuffer.toString(); const data = dataBuffer.toString();
if (!data) { if (!data) {
return callback("ReportFileNotFound", options); return callback("ReportFileNotFound", options);
} }
@ -98,4 +97,4 @@ exports.getReport = function (app, options, callback) {
return loadReport(app, result, callback); return loadReport(app, result, callback);
}); });
} };

@ -1,38 +1,37 @@
"use strict"; "use strict";
//TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here. //TaskProcessor does not look like EventEmitter, so no need to extend EventEmitter and use `emit' here.
var TaskProcessor = function (task, outerProcessor, callback) { const TaskProcessor = function (task, outerProcessor, callback) {
if (!this) { if (!this) {
return new TaskProcessor(task); return new TaskProcessor(task);
} }
var self = this, const self = this;
taskImpl, let taskWorker = undefined;
taskWorker, const errors = [];
errors = [], const process = function () {
process = function () { taskWorker.process();
taskWorker.process(); };
}, const getOuterPrefix = function (prefix) {
getOuterPrefix = function (prefix) { return (task.name && prefix) ? (task.name + "/" + prefix) : (task.name || "") + (prefix || "");
return (task.name && prefix) ? (task.name + "/" + prefix) : (task.name || "") + (prefix || ""); };
}, const onError = function (message, prefix) {
onError = function (message, prefix) { errors.push(message);
errors.push(message); outerProcessor.onError(message, getOuterPrefix(prefix));
outerProcessor.onError(message, getOuterPrefix(prefix)); };
}, const onWarn = function (message, prefix) {
onWarn = function (message, prefix) { outerProcessor.onWarn(message, getOuterPrefix(prefix));
outerProcessor.onWarn(message, getOuterPrefix(prefix)); };
}, const onInfo = function (message, prefix) {
onInfo = function (message, prefix) { outerProcessor.onInfo(message, getOuterPrefix(prefix));
outerProcessor.onInfo(message, getOuterPrefix(prefix)); };
}, const processTask = function (innerTask, innerCallback) {
processTask = function (innerTask, innerCallback) { const innerProcessor = new TaskProcessor(innerTask, self, innerCallback);
var innerProcessor = new TaskProcessor(innerTask, self, innerCallback); innerProcessor.process();
innerProcessor.process(); };
}, const done = function () {
done = function () { callback(errors.join("\r\n"));
callback(errors.join("\r\n")); };
};
self.process = process; self.process = process;
self.onError = onError; self.onError = onError;
@ -42,50 +41,49 @@ var TaskProcessor = function (task, outerProcessor, callback) {
self.done = done; self.done = done;
self.context = outerProcessor.context; self.context = outerProcessor.context;
taskImpl = require('./tasks/' + task.type.match(/[\w\-]/g).join("")); const taskImpl = require('./tasks/' + task.type.match(/[\w\-]/g).join(""));
taskWorker = taskImpl(task.params || {}, self); taskWorker = taskImpl(task.params || {}, self);
}; };
exports.processTask = function (task, context, callback) { exports.processTask = function (task, context, callback) {
var errors = {}, const errors = {};
warns = {}, const warns = {};
infos = {}, const infos = {};
messages = {}, const messages = {};
messageProcessor = function (list) { const messageProcessor = function (list) {
var f = function (list, message, prefix) { const f = function (list, message, prefix) {
var i, const parts = prefix.split("/");
parts = prefix.split("/"), let innerList = list;
innerList = list;
for (i = 0; i < parts.length; i += 1) { parts.forEach(function (part) {
innerList = (innerList[parts[i]] = innerList[parts[i]] || {}); innerList = (innerList[part] = innerList[part] || {});
} });
innerList.$messages = innerList.$messages || []; innerList.$messages = innerList.$messages || [];
innerList.$messages.push(message); innerList.$messages.push(message);
list.$allMessages = list.$allMessages || []; list.$allMessages = list.$allMessages || [];
list.$allMessages.push({ prefix: prefix, message: message }); list.$allMessages.push({ prefix: prefix, message: message });
}; };
return function (message, prefix) { return function (message, prefix) {
f(list, message, prefix); f(list, message, prefix);
f(messages, message, prefix); f(messages, message, prefix);
}; };
}, };
processor = new TaskProcessor(task, { const processor = new TaskProcessor(task, {
onError: messageProcessor(errors), onError: messageProcessor(errors),
onWarn: messageProcessor(warns), onWarn: messageProcessor(warns),
onInfo: messageProcessor(infos), onInfo: messageProcessor(infos),
context: context context: context
}, function (err) { }, function (err) {
callback(err, { callback(err, {
errors: errors, errors: errors,
warns: warns, warns: warns,
infos: infos, infos: infos,
messages: messages messages: messages
});
}); });
});
processor.process(); processor.process();
}; };

@ -1,7 +1,6 @@
"use strict"; "use strict";
var glob = require('glob'); const glob = require('glob');
var deleteFromCode = require('./deletefromcode');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
@ -33,7 +32,7 @@ module.exports = function (params, processor) {
}) })
} }
}, processor.done.bind(processor)); }, processor.done.bind(processor));
}) });
} }
}; };
}; };

@ -1,8 +1,8 @@
"use strict"; "use strict";
module.exports = function (params, processor) { module.exports = function (params, processor) {
var condition = (!params.owner || params.owner === processor.context.owner) && (!params.branch || params.branch === processor.context.branch || "refs/heads/" + params.branch === processor.context.branch), const condition = (!params.owner || params.owner === processor.context.owner) && (!params.branch || params.branch === processor.context.branch || "refs/heads/" + params.branch === processor.context.branch);
task = condition ? params.task : params.otherwise; const task = condition ? params.task : params.otherwise;
return { return {
process: function () { process: function () {

@ -1,12 +1,12 @@
"use strict"; "use strict";
var fse = require('fs-extra'); const fse = require('fs-extra');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
process: function () { process: function () {
var sourceFilePath = processor.context.exported + "/" + params.filename, const sourceFilePath = processor.context.exported + "/" + params.filename;
targetFilePath = processor.context.release + "/" + params.filename; const targetFilePath = processor.context.release + "/" + params.filename;
processor.onInfo("Copying " + sourceFilePath + " to " + targetFilePath); processor.onInfo("Copying " + sourceFilePath + " to " + targetFilePath);

@ -1,7 +1,6 @@
"use strict"; "use strict";
var fse = require('fs-extra'); const glob = require('glob');
var glob = require('glob');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {

@ -1,6 +1,6 @@
"use strict"; "use strict";
var fse = require('fs-extra'); const fse = require('fs-extra');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {

@ -1,6 +1,6 @@
"use strict"; "use strict";
var sequential = require('./sequential'); const sequential = require('./sequential');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return sequential({ return sequential({

@ -1,7 +1,6 @@
"use strict"; "use strict";
var sequential = require("./sequential"); const sequential = require("./sequential");
var settings = require("../../settings");
module.exports = function (params, processor) { module.exports = function (params, processor) {
return sequential({ return sequential({

@ -1,14 +1,14 @@
"use strict"; "use strict";
var spawn = require('child_process').spawn; const spawn = require('child_process').spawn;
var settings = require("../../settings"); const settings = require("../../settings");
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
process: function () { process: function () {
var result = "", let result = "";
error = "", let error = "";
builder = spawn(settings.builderExecutable, [params.command]); const builder = spawn(settings.builderExecutable, [params.command]);
processor.onInfo("DotNetBuilderWrapper processing (at " + (new Date().toISOString()) + "): " + JSON.stringify(params, null, 4)); processor.onInfo("DotNetBuilderWrapper processing (at " + (new Date().toISOString()) + "): " + JSON.stringify(params, null, 4));
@ -25,26 +25,22 @@ module.exports = function (params, processor) {
return processor.done(); return processor.done();
} }
var report = JSON.parse(result); const report = JSON.parse(result);
var messages = report.Messages; const messages = report.Messages;
for (var i = 0; i < messages.length; i++) { messages.forEach(function (message) {
if (!messages[i]) { if (!message) {
processor.onError("Message is null"); return processor.onError("Message is null");
continue;
} }
switch(messages[i].Type) { switch(message.Type) {
case "info": case "info":
processor.onInfo(messages[i].Body); return processor.onInfo(message.Body);
break;
case "warn": case "warn":
processor.onWarn(messages[i].Body); return processor.onWarn(message.Body);
break;
default: default:
processor.onError(messages[i].Body); return processor.onError(message.Body);
break;
} }
} });
processor.onInfo("Done DotNetBuilderWrapper processing (at " + (new Date().toISOString()) + ")"); processor.onInfo("Done DotNetBuilderWrapper processing (at " + (new Date().toISOString()) + ")");
return processor.done(); return processor.done();

@ -1,9 +1,9 @@
"use strict"; "use strict";
var sequential = require('./sequential'); const sequential = require('./sequential');
module.exports = function (params, processor) { module.exports = function (params, processor) {
var tasks = []; let tasks = [];
if (!params.skipMbsCheckStyle) { if (!params.skipMbsCheckStyle) {
tasks.push({ tasks.push({

@ -1,10 +1,10 @@
"use strict"; "use strict";
var fs = require('fs'); const fs = require('fs');
var async = require('async'); const async = require('async');
var glob = require('glob'); const glob = require('glob');
var autoGeneratedMarker = const autoGeneratedMarker =
"//------------------------------------------------------------------------------" + "\n" + "//------------------------------------------------------------------------------" + "\n" +
"// <auto-generated>"; "// <auto-generated>";

@ -1,10 +1,10 @@
"use strict"; "use strict";
var settings = require('../../settings'); const settings = require('../../settings');
var dotnetbuilderwrapper = require('./dotnetbuilderwrapper'); const dotnetbuilderwrapper = require('./dotnetbuilderwrapper');
module.exports = function (params, processor) { module.exports = function (params, processor) {
var compileParams = { const compileParams = {
command: "compile", command: "compile",
SolutionPath: processor.context.exported + "/" + params.solution, SolutionPath: processor.context.exported + "/" + params.solution,
Configuration: params.configuration, Configuration: params.configuration,
@ -30,4 +30,4 @@ module.exports = function (params, processor) {
} }
} }
return dotnetbuilderwrapper(compileParams, processor); return dotnetbuilderwrapper(compileParams, processor);
} };

@ -1,11 +1,10 @@
"use strict"; "use strict";
var sequential = require('./sequential'); const sequential = require('./sequential');
module.exports = function (params, processor) { module.exports = function (params, processor) {
var date = new Date(), const date = new Date();
version = (params.version || ((params.major || "0") + "." + (date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()) + "." + ((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()))) + (params.withoutCommitSha ? "" : ("-r" + processor.context.rev.substr(0, 16))), const version = (params.version || ((params.major || "0") + "." + (date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()) + "." + ((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()))) + (params.withoutCommitSha ? "" : ("-r" + processor.context.rev.substr(0, 16)));
nupkg = processor.context.exported + "/" + params.name + "." + version + ".nupkg";
return sequential({ return sequential({
tasks: [ tasks: [

@ -1,31 +1,31 @@
"use strict"; "use strict";
var conditional = require('./conditional'); const conditional = require('./conditional');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return conditional({ return conditional({
"owner": params.masterRepoOwner, owner: params.masterRepoOwner,
"branch": "master", branch: "master",
"task": { task: {
"name": "nuget-push", name: "nuget-push",
"type": "dotnetnugetpush", type: "dotnetnugetpush",
"params": { params: {
"nuspec": params.nuspecName + ".nuspec", nuspec: params.nuspecName + ".nuspec",
"name": params.nuspecName, name: params.nuspecName,
"withoutCommitSha": params.withoutCommitSha, withoutCommitSha: params.withoutCommitSha,
"version": params.version, version: params.version,
"major": params.major major: params.major
} }
}, },
"otherwise": { otherwise: {
"name": "nuget-pack", name: "nuget-pack",
"type": "dotnetnugetpack", type: "dotnetnugetpack",
"params": { params: {
"nuspec": params.nuspecName + ".nuspec", nuspec: params.nuspecName + ".nuspec",
"name": params.nuspecName, name: params.nuspecName,
"withoutCommitSha": params.withoutCommitSha, withoutCommitSha: params.withoutCommitSha,
"version": params.version, version: params.version,
"major": params.major major: params.major
} }
} }
}, processor); }, processor);

@ -1,12 +1,11 @@
"use strict"; "use strict";
var sequential = require("./sequential"); const sequential = require("./sequential");
var settings = require("../../settings");
module.exports = function (params, processor) { module.exports = function (params, processor) {
var date = new Date(), const date = new Date();
version = (params.version || ((params.major || "0") + "." + (date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()) + "." + ((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()))) + (params.withoutCommitSha ? "" : ("-r" + processor.context.rev.substr(0, 16))), const version = (params.version || ((params.major || "0") + "." + (date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()) + "." + ((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()))) + (params.withoutCommitSha ? "" : ("-r" + processor.context.rev.substr(0, 16)));
nupkg = params.name + "." + version + ".nupkg"; const nupkg = params.name + "." + version + ".nupkg";
return sequential({ return sequential({
tasks: [ tasks: [

@ -1,8 +1,7 @@
"use strict"; "use strict";
var sequential = require("./sequential"); const dotnetbuilderwrapper = require('./dotnetbuilderwrapper');
var dotnetbuilderwrapper = require('./dotnetbuilderwrapper'); const settings = require("../../settings");
var settings = require("../../settings");
module.exports = function (params, processor) { module.exports = function (params, processor) {
return dotnetbuilderwrapper({ return dotnetbuilderwrapper({

@ -1,6 +1,6 @@
"use strict"; "use strict";
var sequential = require('./sequential'); const sequential = require('./sequential');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return sequential({ return sequential({

@ -1,6 +1,6 @@
"use strict"; "use strict";
var dotNetBuilderWrapper = require('./dotnetbuilderwrapper'); const dotNetBuilderWrapper = require('./dotnetbuilderwrapper');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return dotNetBuilderWrapper({ return dotNetBuilderWrapper({

@ -1,7 +1,6 @@
"use strict"; "use strict";
var glob = require('glob'); const glob = require('glob');
var dotNetBuilderWrapper = require('./dotnetbuilderwrapper');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
@ -40,7 +39,7 @@ module.exports = function (params, processor) {
}) })
} }
}, processor.done.bind(processor)); }, processor.done.bind(processor));
}) });
} }
}; };
}; };

@ -1,16 +1,15 @@
"use strict"; "use strict";
var fs = require('fs'), const fs = require('fs');
Mustache = require('mustache'); const Mustache = require('mustache');
var sequential = require('./sequential'); const sequential = require('./sequential');
var msbuildTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.msbuild", {encoding: "utf8"}); const msbuildTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.msbuild", {encoding: "utf8"});
var deployTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.bat", {encoding: "utf8"}); const deployTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.bat", {encoding: "utf8"});
var versionTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.version.aspx", {encoding: "utf8"}); const versionTemplate = fs.readFileSync(__dirname + "/dotnetpackwebapp.template.version.aspx", {encoding: "utf8"});
module.exports = function (params, processor) { module.exports = function (params, processor) {
return sequential({ return sequential({
tasks: [ tasks: [
{ {

@ -1,13 +1,13 @@
"use strict"; "use strict";
var fs = require('fs'); const fs = require('fs');
var async = require('async'); const async = require('async');
var glob = require('glob'); const glob = require('glob');
var settings = require('../../settings'); const settings = require('../../settings');
var addAssemblyAttribute = function (content, attribute) { const addAssemblyAttribute = function (content, attribute) {
return content + "\n" + attribute + "\n"; return content + "\n" + attribute + "\n";
} };
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
@ -18,19 +18,20 @@ module.exports = function (params, processor) {
processor.context.dotnetrewriterDone = true; processor.context.dotnetrewriterDone = true;
var date = new Date(), const date = new Date();
version = date.getFullYear() + "." + const version = date.getFullYear() + "." +
(date.getMonth() + 1) + "." + (date.getMonth() + 1) + "." +
date.getDate() + "." + date.getDate() + "." +
(date.getHours() * 100 + date.getMinutes()) + "; " + (date.getHours() * 100 + date.getMinutes()) + "; " +
"built from " + processor.context.rev + "; " + "built from " + processor.context.rev + "; " +
"repository: " + processor.context.owner + "/" + processor.context.reponame + "; " + "repository: " + processor.context.owner + "/" + processor.context.reponame + "; " +
"branch: " + processor.context.branch, "branch: " + processor.context.branch;
processAssemblyInfo = function (appendInformationalVersion) {
const processAssemblyInfo = function (appendInformationalVersion) {
return function (content, cb) { return function (content, cb) {
if (!params.skipCodeSigning && !settings.skipCodeSigning) { if (!params.skipCodeSigning && !settings.skipCodeSigning) {
content = content.replace( content = content.replace(
/InternalsVisibleTo\s*\(\s*\"([\w.]+)\"\s*\)/g, /InternalsVisibleTo\s*\(\s*"([\w.]+)"\s*\)/g,
function (match, p1) { function (match, p1) {
return "InternalsVisibleTo(\"" + p1 + ",PublicKey=" + settings.codeSigningPublicKey + "\")"; return "InternalsVisibleTo(\"" + p1 + ",PublicKey=" + settings.codeSigningPublicKey + "\")";
} }
@ -72,9 +73,9 @@ module.exports = function (params, processor) {
} }
callback(err); callback(err);
}); });
} };
}), processor.done.bind(processor)); }), processor.done.bind(processor));
}) });
} }
}; };
}; };

@ -1,6 +1,6 @@
"use strict"; "use strict";
var async = require("async"); const async = require("async");
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
@ -9,8 +9,8 @@ module.exports = function (params, processor) {
return function (callback) { return function (callback) {
return processor.processTask(task, function (err) { return processor.processTask(task, function (err) {
return callback(); return callback();
}) });
} };
}), processor.done.bind(processor)); }), processor.done.bind(processor));
} }
}; };

@ -1,9 +1,9 @@
"use strict"; "use strict";
var async = require("async"); const async = require("async");
module.exports = function (params, processor) { module.exports = function (params, processor) {
var mapper = Function.bind.bind(processor.processTask, processor); const mapper = Function.bind.bind(processor.processTask, processor);
return { return {
process: function () { process: function () {
async.series(params.tasks.map(function (element) { return mapper(element); }), processor.done.bind(processor)); async.series(params.tasks.map(function (element) { return mapper(element); }), processor.done.bind(processor));

@ -1,13 +1,11 @@
"use strict"; "use strict";
var fs = require('fs'); const fs = require('fs');
var async = require('async');
var glob = require('glob');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return {
process: function () { process: function () {
var filePath = processor.context.exported + "/" + params.filename; const filePath = processor.context.exported + "/" + params.filename;
processor.onInfo("Writing to " + filePath); processor.onInfo("Writing to " + filePath);
fs.writeFile(filePath, params.data, function(err) { fs.writeFile(filePath, params.data, function(err) {

@ -1,7 +1,7 @@
"use strict"; "use strict";
module.exports = function(req, res) { module.exports = function(req, res) {
var options = { const options = {
owner: req.params.owner, owner: req.params.owner,
reponame: req.params.reponame, reponame: req.params.reponame,
branchName: req.params.branch, branchName: req.params.branch,

@ -1,10 +1,7 @@
"use strict";
/*
* GET home page.
*/
exports.index = function(req, res){ exports.index = function(req, res){
res.render('index', { title: 'Express' + req + "qq" }); res.render('index', { title: 'Express' + req + "qq" });
}; };
exports.postreceive = require('./postreceive'); exports.postreceive = require('./postreceive');

@ -1,4 +1,6 @@
var builder = require('../lib/builder'); "use strict";
const builder = require('../lib/builder');
exports.get = function (req, res) { exports.get = function (req, res) {
res.render('manual'); res.render('manual');

@ -1,22 +1,18 @@
"use strict"; "use strict";
var builder = require('../lib/builder'), const builder = require('../lib/builder');
commenter = require('../lib/commenter'); const commenter = require('../lib/commenter');
/* const processPush = function (req, res, payload) {
* POST from github const repository = payload.repository;
*/ const options = {
app: req.app,
var processPush = function (req, res, payload) { url: repository.url,
var repository = payload.repository, owner: repository.owner.name,
options = { reponame: repository.name,
app: req.app, rev: payload.after,
url: repository.url, branch: payload.ref
owner: repository.owner.name, };
reponame: repository.name,
rev: payload.after,
branch: payload.ref
};
console.log("Got push event for " + options.owner + "/" + options.reponame + ":" + options.branch); console.log("Got push event for " + options.owner + "/" + options.reponame + ":" + options.branch);
@ -29,41 +25,41 @@ var processPush = function (req, res, payload) {
}); });
}; };
var processPullRequest = function (req, res, payload) { const processPullRequest = function (req, res, payload) {
var action = payload.action, const action = payload.action;
number = payload.number, const number = payload.number;
pullRequest = payload.pull_request, const pullRequest = payload.pull_request;
head = pullRequest.head, const head = pullRequest.head;
headRepo = head.repo, const headRepo = head.repo;
headRepoOptions = { const headRepoOptions = {
url: headRepo.url, url: headRepo.url,
owner: headRepo.owner.name || headRepo.owner.login, owner: headRepo.owner.name || headRepo.owner.login,
reponame: headRepo.name, reponame: headRepo.name,
rev: head.sha, rev: head.sha,
branchname: head.ref, branchname: head.ref,
branch: "refs/heads/" + head.ref branch: "refs/heads/" + head.ref
}, };
base = pullRequest.base, const base = pullRequest.base;
baseRepo = base.repo, const baseRepo = base.repo;
baseRepoOptions = { const baseRepoOptions = {
owner: baseRepo.owner.name || baseRepo.owner.login, owner: baseRepo.owner.name || baseRepo.owner.login,
reponame: baseRepo.name, reponame: baseRepo.name,
branchname: base.ref branchname: base.ref
}, };
options = { const options = {
app: req.app, app: req.app,
action: action, action: action,
number: number, number: number,
headRepoOptions: headRepoOptions, headRepoOptions: headRepoOptions,
baseRepoOptions: baseRepoOptions baseRepoOptions: baseRepoOptions
}, };
masterOptions = { const masterOptions = {
app: req.app, app: req.app,
action: action, action: action,
number: number, number: number,
headRepoOptions: baseRepoOptions, headRepoOptions: baseRepoOptions,
baseRepoOptions: baseRepoOptions baseRepoOptions: baseRepoOptions
}; };
console.log("Got pull request " + action + " event, from " + headRepoOptions.owner + "/" + headRepoOptions.reponame + ":" + headRepoOptions.branchname + " (" + headRepoOptions.rev + ") to " + baseRepoOptions.owner + "/" + baseRepoOptions.reponame + ":" + baseRepoOptions.branchname); console.log("Got pull request " + action + " event, from " + headRepoOptions.owner + "/" + headRepoOptions.reponame + ":" + headRepoOptions.branchname + " (" + headRepoOptions.rev + ") to " + baseRepoOptions.owner + "/" + baseRepoOptions.reponame + ":" + baseRepoOptions.branchname);
@ -99,8 +95,8 @@ module.exports = function (req, res) {
return res.end(); return res.end();
} }
var eventType = req.header("x-github-event"), const eventType = req.header("x-github-event");
payload = req.body.payload ? JSON.parse(req.body.payload || "{}") : req.body; const payload = req.body.payload ? JSON.parse(req.body.payload || "{}") : req.body;
if (eventType === "push") { if (eventType === "push") {
return processPush(req, res, payload); return processPush(req, res, payload);

@ -1,11 +1,11 @@
"use strict"; "use strict";
var path = require('path'), const path = require('path');
fs = require('fs'), const fs = require('fs');
Zip = require('adm-zip'); const Zip = require('adm-zip');
var getReport = function(releasePath, callback) { const getReport = function(releasePath, callback) {
var reportFile = releasePath + "report.json"; const reportFile = releasePath + "report.json";
fs.exists(reportFile, function (exists) { fs.exists(reportFile, function (exists) {
if (!exists) { if (!exists) {
@ -14,27 +14,27 @@ var getReport = function(releasePath, callback) {
return fs.readFile(reportFile, function (err, dataBuffer) { return fs.readFile(reportFile, function (err, dataBuffer) {
if (err) { if (err) {
return callback(err, options); return callback(err, reportFile);
} }
var data = dataBuffer.toString(); const data = dataBuffer.toString();
if (!data) { if (!data) {
return callback("ReportFileNotFound", options); return callback("ReportFileNotFound", reportFile);
} }
var report = JSON.parse(data); const report = JSON.parse(data);
return callback(null, report); return callback(null, report);
}); });
}); });
}; };
var getDatePart = function (report) { const getDatePart = function (report) {
if (!report.date) { if (!report.date) {
return "unknowndate"; return "unknowndate";
} }
var date = new Date(report.date), const date = new Date(report.date);
paddingLeft = function (str, paddingValue) { const paddingLeft = function (str, paddingValue) {
return String(paddingValue + str).slice(-paddingValue.length); return String(paddingValue + str).slice(-paddingValue.length);
}; };
return date.getFullYear() + "." + return date.getFullYear() + "." +
paddingLeft(date.getMonth() + 1, "00") + "." + paddingLeft(date.getMonth() + 1, "00") + "." +
@ -45,7 +45,7 @@ var getDatePart = function (report) {
}; };
module.exports = function(req, res, next) { module.exports = function(req, res, next) {
var options = { const options = {
owner: req.params.owner, owner: req.params.owner,
reponame: req.params.reponame, reponame: req.params.reponame,
branchName: req.params.branch, branchName: req.params.branch,
@ -53,8 +53,8 @@ module.exports = function(req, res, next) {
rev: req.params.rev rev: req.params.rev
}; };
var zip = new Zip(), const zip = new Zip();
releasePath = path.normalize(req.app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev + "/"); const releasePath = path.normalize(req.app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev + "/");
getReport(releasePath, function (err, report) { getReport(releasePath, function (err, report) {
if (err) { if (err) {

@ -1,19 +1,17 @@
"use strict"; "use strict";
var fs = require('fs'), const url = require('url');
url = require('url'), const statusProcessor = require('../lib/status-processor');
glob = require('glob'),
statusProcessor = require('../lib/status-processor');
var parseOptionsFromReferer = function (path, callback) { const parseOptionsFromReferer = function (path, callback) {
var pathParts = path.split("/").filter(function (value) { return value; }); const pathParts = path.split("/").filter(function (value) { return value; });
var result = {}; const result = {};
if (pathParts.length < 2) { if (pathParts.length < 2) {
return callback("BadRequest", result); return callback("BadRequest", result);
} }
if (pathParts[2] == "tree") { if (pathParts[2] === "tree") {
pathParts.splice(2, 1); pathParts.splice(2, 1);
} }
@ -24,16 +22,16 @@ var parseOptionsFromReferer = function (path, callback) {
return callback(null, result); return callback(null, result);
}; };
var createShowReport = function (res) { const createShowReport = function (res) {
return function (err, options) { return function (err, options) {
options = options || {}; options = options || {};
options.err = err; options.err = err;
res.render('status', options); res.render('status', options);
} };
} };
exports.image = function(req, res) { exports.image = function(req, res) {
var handle = function (err, options) { const handle = function (err, options) {
if (err === "ReportFileNotFound") { if (err === "ReportFileNotFound") {
options.status = "Building"; options.status = "Building";
} else if (err) { } else if (err) {
@ -69,7 +67,7 @@ exports.image = function(req, res) {
}; };
exports.page = function(req, res) { exports.page = function(req, res) {
var options = { const options = {
owner: req.params.owner, owner: req.params.owner,
reponame: req.params.reponame, reponame: req.params.reponame,
branchName: req.params.branch, branchName: req.params.branch,
@ -88,5 +86,4 @@ exports.pageFromGithub = function (req, res) {
return statusProcessor.getReport(req.app, options, createShowReport(res)); return statusProcessor.getReport(req.app, options, createShowReport(res));
}); });
} };

Loading…
Cancel
Save