2016-05-30 00:29:30 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
|
|
|
var plugins = require("./npmci.plugins");
|
2016-06-01 03:44:48 +00:00
|
|
|
var npmci_prepare_1 = require("./npmci.prepare");
|
2016-05-30 01:40:07 +00:00
|
|
|
var npmci_bash_1 = require("./npmci.bash");
|
2016-06-01 03:44:48 +00:00
|
|
|
exports.publish = function (serviceArg) {
|
|
|
|
if (serviceArg === void 0) { serviceArg = "npm"; }
|
2016-05-30 00:29:30 +00:00
|
|
|
var done = plugins.q.defer();
|
2016-06-01 03:44:48 +00:00
|
|
|
switch (serviceArg) {
|
|
|
|
case "npm":
|
|
|
|
publishNpm()
|
|
|
|
.then(function () {
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "docker":
|
|
|
|
publishDocker()
|
|
|
|
.then(function () {
|
|
|
|
done.resolve();
|
|
|
|
});
|
2016-05-30 03:13:15 +00:00
|
|
|
}
|
2016-06-01 03:44:48 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
var publishNpm = function () {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
npmci_prepare_1.prepare("npm")
|
|
|
|
.then(function () {
|
|
|
|
npmci_bash_1.bash("npm publish");
|
|
|
|
plugins.beautylog.ok("Done!");
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
var publishDocker = function () {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
npmci_prepare_1.prepare("docker")
|
|
|
|
.then(function () {
|
|
|
|
npmci_bash_1.bash("docker push");
|
|
|
|
});
|
2016-05-30 00:29:30 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
|
2016-06-01 03:44:48 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW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zZSBcImRvY2tlclwiOlxyXG4gICAgICAgICAgICBwdWJsaXNoRG9ja2VyKClcclxuICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKCk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgIH1cclxuICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbn07XHJcblxyXG5sZXQgcHVibGlzaE5wbSAgPSBmdW5jdGlvbigpe1xyXG4gICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgIHByZXBhcmUoXCJucG1cIilcclxuICAgICAgICAudGhlbihmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBiYXNoKFwibnBtIHB1Ymxpc2hcIik7XHJcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLm9rKFwiRG9uZSFcIikgO1xyXG4gICAgICAgICAgICBkb25lLnJlc29sdmUoKTtcclxuICAgICAgICB9KTtcclxuICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxufVxyXG5cclxubGV0IHB1Ymxpc2hEb2NrZXIgPSBmdW5jdGlvbigpe1xyXG4gICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgIHByZXBhcmUoXCJkb2NrZXJcIilcclxuICAgICAgICAudGhlbihmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBiYXNoKFwiZG9ja2VyIHB1c2hcIik7XHJcbiAgICAgICAgfSk7XHJcbiAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG59OyJdfQ==
|