From 3a6e2d6f3d3948275c657131a37f850529f26438 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 1 Jun 2016 06:30:21 +0200 Subject: [PATCH] run triggers --- ts/index.ts | 4 +++- ts/npmci.trigger.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ts/npmci.trigger.ts diff --git a/ts/index.ts b/ts/index.ts index 62baa0d..dfd0ac6 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -9,6 +9,7 @@ plugins.beautylog.info("npmci version: " + packJson.version); import {install} from "./npmci.install"; import {test} from "./npmci.test"; import {publish} from "./npmci.publish"; +import {trigger} from "./npmci.trigger"; let command; @@ -39,7 +40,8 @@ switch (command){ break; case "publish": - publish(commandOption); + publish(commandOption) + .then(trigger); break; default: break; diff --git a/ts/npmci.trigger.ts b/ts/npmci.trigger.ts new file mode 100644 index 0000000..484a6af --- /dev/null +++ b/ts/npmci.trigger.ts @@ -0,0 +1,18 @@ +import "typings-global"; +import * as plugins from "./npmci.plugins"; +import {prepare} from "./npmci.prepare"; +import {bash} from "./npmci.bash"; + +export let trigger = function(){ + let done = plugins.q.defer(); + plugins.beautylog.info("now running triggers"); + for(let i = 0; i < 100; i++){ + let iteratorString = i.toString(); + if(process.env["TRIGGER" + iteratorString]){ + plugins.beautylog.log("Found TRIGGER" + iteratorString); + bash("curl -X POST " + process.env["TRIGGER" + iteratorString]); + } + } + done.resolve(); + return done.promise; +} \ No newline at end of file