tscoverage/dist/npmts.publish.js

27 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2016-03-26 13:08:48 +00:00
"use strict";
2016-05-25 03:23:48 +00:00
require("typings-global");
2016-03-26 13:08:48 +00:00
var plugins = require("./npmts.plugins");
2016-05-29 18:56:53 +00:00
var paths = require("./npmts.paths");
2016-03-26 13:08:48 +00:00
var NpmtsJsdoc = require("./npmts.jsdoc");
2016-05-29 18:56:53 +00:00
exports.publishCoverage = function (configArg) {
var done = plugins.Q.defer();
plugins.beautylog.log("now uploading coverage data to codecov.io");
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
.pipe(plugins.g.codecov())
.pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok("Coverage data has been uploaded to codecov.io!");
done.resolve(configArg);
}, "atEnd"));
return done.promise;
};
2016-03-26 13:08:48 +00:00
exports.run = function (configArg) {
var done = plugins.Q.defer();
var config = configArg;
var promiseArray = [];
2016-05-29 18:56:53 +00:00
config.codecov.publish ? promiseArray.push(exports.publishCoverage(configArg)) : void (0);
2016-03-26 13:08:48 +00:00
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void (0);
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void (0);
2016-03-26 16:35:55 +00:00
plugins.Q.all(promiseArray).then(done.resolve);
2016-03-26 13:08:48 +00:00
return done.promise;
};