Skip to content

Commit

Permalink
Adding setupArtifactsUrl method for setting up artifacts url
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavparikh committed Jan 22, 2014
1 parent a001ebf commit 8741aa3
Showing 1 changed file with 66 additions and 5 deletions.
71 changes: 66 additions & 5 deletions lib/util/arrowsetup.js
Expand Up @@ -42,6 +42,12 @@ ArrowSetup.prototype.setup = function (callback) {
});
},

function(cb) {
self.setupArtifactsUrl(function() {
return cb(null, 'setupArtifactsUrl');
});
},

function(cb) {
self.setupDefaultDriverName(function() {
return cb(null, 'setupDefaultDriverName');
Expand Down Expand Up @@ -264,6 +270,7 @@ ArrowSetup.prototype.setupReportDir = function (cb) {
if (this.argv.artifactsUrl) {
artifactsUrl = this.argv.artifactsUrl;
}

// console.log('****Setup report dir, artifactsUrl:' + artifactsUrl);
// To generate the reports, if either report is true or reportFolder is passed
if (this.argv.reportFolder) {
Expand All @@ -283,31 +290,85 @@ ArrowSetup.prototype.setupReportDir = function (cb) {
// Create arrow-report directory
fileUtil.createDirectory(reportFolderPath);

this.argv.reportFolder = targetFolderPath;
// this.argv.reportFolder = targetFolderPath;
global.reportFolder = this.argv.reportFolder || "";

}
if (artifactsUrl) {


// if (artifactsUrl) {
//// console.log('****Setup report dir, artifactsUrl 1:' + artifactsUrl);
////
//// console.log('****Setup report dir, artifactsUrl 2:' + artifactsUrl);
// artifactsUrl = url.resolve(artifactsUrl,'');
// if(artifactsUrl.indexOf('/', artifactsUrl.length - 1) == -1){
// artifactsUrl += '/';
// }
// artifactsUrl += targetFolderRelPath;
//// artifactsUrl = path.join(url.resolve(artifactsUrl,'') , targetFolderRelPath);
//// console.log('****Setup report dir, after resolving:' + artifactsUrl);
// global.artifactsUrl = artifactsUrl;
// }

self.logger.trace('setupReportDir ends');

if (cb) {
cb();
}

};

ArrowSetup.prototype.setupArtifactsUrl = function (cb) {

var self = this,
artifactsUrl,
arrowTargetDir = 'arrow-target',
targetFolderRelPath, // relative path till target directory
reportFolder = "";

self.logger.trace('setupArtifactsUrl starts');

// To generate the reports, if either report is true or reportFolder is passed
if (this.argv.reportFolder) {
reportFolder = this.argv.reportFolder;
}

// console.log('****setupArtifactsUrl, reportFolder:' + reportFolder);
// console.log('****setupArtifactsUrl, arrowTargetDir:' + arrowTargetDir);

targetFolderRelPath = path.join(reportFolder,arrowTargetDir); // Relative path to target directory

// console.log('****setupArtifactsUrl, targetFolderRelPath:' + targetFolderRelPath);

if (this.argv.artifactsUrl) {

// console.log('****Setup report dir, artifactsUrl 1:' + artifactsUrl);
//
// console.log('****Setup report dir, artifactsUrl 2:' + artifactsUrl);
artifactsUrl = url.resolve(artifactsUrl,'');

artifactsUrl = url.resolve(this.argv.artifactsUrl,'');

// console.log('****setupArtifactsUrl, artifactsUrl 1:' + artifactsUrl);

if(artifactsUrl.indexOf('/', artifactsUrl.length - 1) == -1){
artifactsUrl += '/';
}
// console.log('****setupArtifactsUrl, artifactsUrl 2:' + artifactsUrl);
artifactsUrl += targetFolderRelPath;
// artifactsUrl = path.join(url.resolve(artifactsUrl,'') , targetFolderRelPath);
// console.log('****setupArtifactsUrl, artifactsUrl 3:' + artifactsUrl);
// console.log('****Setup report dir, after resolving:' + artifactsUrl);
global.artifactsUrl = artifactsUrl;
}
self.logger.trace('setupReportDir ends');

self.logger.trace('setupArtifactsUrl ends');

if (cb) {
cb();
}

};


ArrowSetup.prototype.setupMisc = function (cb) {

var self = this;
Expand Down

0 comments on commit 8741aa3

Please sign in to comment.