From 3ce49c7e973cb199c2929e73997fa5453031554b Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Mon, 14 Mar 2016 04:32:52 +0100 Subject: [PATCH] now handling cli option --- dist/npmts.assets.js | 16 ++++++++++++++++ dist/npmts.install.js | 2 +- dist/npmts.jsdoc.js | 4 ++-- dist/npmts.paths.js | 1 + dist/npmts.promisechain.js | 14 +++++++++----- package.json | 6 +++--- test/assets/dist/cli.js | 2 ++ test/assets/npmts.json | 3 ++- ts/npmts.assets.ts | 15 +++++++++++++++ ts/npmts.install.ts | 2 +- ts/npmts.jsdoc.ts | 4 ++-- ts/npmts.paths.ts | 2 ++ ts/npmts.promisechain.ts | 17 ++++++++++++----- 13 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 dist/npmts.assets.js create mode 100644 test/assets/dist/cli.js create mode 100644 ts/npmts.assets.ts diff --git a/dist/npmts.assets.js b/dist/npmts.assets.js new file mode 100644 index 0000000..f42daf1 --- /dev/null +++ b/dist/npmts.assets.js @@ -0,0 +1,16 @@ +"use strict"; +/// +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +exports.run = function (configArg) { + var done = plugins.Q.defer(); + var config = configArg; + if (config.cli == true) { + plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir); + done.resolve(config); + } + else { + done.resolve(config); + } + return done.promise; +}; diff --git a/dist/npmts.install.js b/dist/npmts.install.js index e3616fd..c7a81c1 100644 --- a/dist/npmts.install.js +++ b/dist/npmts.install.js @@ -1,5 +1,5 @@ "use strict"; -/// +/// var plugins = require("./npmts.plugins"); var paths = require("./npmts.paths"); exports.run = function (configArg) { diff --git a/dist/npmts.jsdoc.js b/dist/npmts.jsdoc.js index 601bf7c..6e171cf 100644 --- a/dist/npmts.jsdoc.js +++ b/dist/npmts.jsdoc.js @@ -37,11 +37,11 @@ var publishDocs = function (configArg) { if (plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish) { plugins.beautylog.log("now publishing docs to GitHub"); if (!plugins.shelljs.which('git')) { - plugins.beautylog.error('Git is not installed'); + plugins.beautylog.error('Git is not installed!'); plugins.shelljs.exit(1); } else if (plugins.shelljs.exec(deployScript).code !== 0) { - plugins.beautylog.error('Error: Git failed'); + plugins.beautylog.error('Git failed!'); plugins.shelljs.exit(1); } plugins.beautylog.ok("JsDoc has been deployed to GitHub!"); diff --git a/dist/npmts.paths.js b/dist/npmts.paths.js index 89e7c83..f814497 100644 --- a/dist/npmts.paths.js +++ b/dist/npmts.paths.js @@ -8,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd, "ts/"); paths.distDir = plugins.path.join(paths.cwd, "dist/"); paths.docsDir = plugins.path.join(paths.cwd, "docs/"); paths.testDir = plugins.path.join(paths.cwd, "test/"); +paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/"); //Files paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts"); paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts"); diff --git a/dist/npmts.promisechain.js b/dist/npmts.promisechain.js index 2421b08..180189e 100644 --- a/dist/npmts.promisechain.js +++ b/dist/npmts.promisechain.js @@ -1,11 +1,12 @@ "use strict"; /// var plugins = require("./npmts.plugins"); -var NpmtsConfigFile = require("./npmts.configfile"); -var NpmtsOptions = require("./npmts.options"); -var NpmtsInstall = require("./npmts.install"); +var NpmtsAssets = require("./npmts.assets"); var NpmtsCompile = require("./npmts.compile"); +var NpmtsConfigFile = require("./npmts.configfile"); +var NpmtsInstall = require("./npmts.install"); var NpmtsJsdoc = require("./npmts.jsdoc"); +var NpmtsOptions = require("./npmts.options"); var NpmtsTests = require("./npmts.tests"); exports.run = function () { var promisechain; @@ -13,6 +14,7 @@ exports.run = function () { .then(NpmtsOptions.run) .then(NpmtsInstall.run) .then(NpmtsCompile.run) + .then(NpmtsAssets.run) .then(NpmtsJsdoc.run) .then(NpmtsTests.run) .then(function (configArg) { @@ -30,8 +32,10 @@ exports.run = function () { " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n"; - console.log(shipString); - plugins.beautylog.success("READY TO SHIP!"); + if (process.env.CI) { + console.log(shipString); + plugins.beautylog.success("READY TO SHIP!"); + } }); return promisechain; }; diff --git a/package.json b/package.json index 53be372..605bda4 100644 --- a/package.json +++ b/package.json @@ -33,18 +33,18 @@ "gulp-function": "^1.1.1", "gulp-if": "^2.0.0", "gulp-istanbul": "^0.10.3", - "gulp-jsdoc3": "^0.2.0", + "gulp-jsdoc3": "^0.2.1", "gulp-mocha": "^2.2.0", "gulp-sourcemaps": "^1.6.0", "gulp-typescript": "2.12.1", - "gulp-typings": "1.1.0", + "gulp-typings": "1.2.0", "merge2": "1.0.1", "projectinfo": "1.0.1", "q": "^1.4.1", "shelljs": "^0.6.0", "smartcli": "0.0.11", "smartenv": "1.2.0", - "smartfile": "0.0.11", + "smartfile": "1.0.1", "smartpath": "2.1.0", "source-map-support": "^0.4.0" }, diff --git a/test/assets/dist/cli.js b/test/assets/dist/cli.js new file mode 100644 index 0000000..9ab44a7 --- /dev/null +++ b/test/assets/dist/cli.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +var index = require("./index.js"); \ No newline at end of file diff --git a/test/assets/npmts.json b/test/assets/npmts.json index a4534f4..d61eb19 100644 --- a/test/assets/npmts.json +++ b/test/assets/npmts.json @@ -12,5 +12,6 @@ "coveralls":true, "docs": { "publish":true - } + }, + "cli":true } \ No newline at end of file diff --git a/ts/npmts.assets.ts b/ts/npmts.assets.ts new file mode 100644 index 0000000..6ab6b9c --- /dev/null +++ b/ts/npmts.assets.ts @@ -0,0 +1,15 @@ +/// +import plugins = require("./npmts.plugins"); +import paths = require("./npmts.paths"); + +export var run = function(configArg){ + let done = plugins.Q.defer(); + let config = configArg; + if(config.cli == true){ + plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir); + done.resolve(config); + } else { + done.resolve(config); + } + return done.promise; +}; \ No newline at end of file diff --git a/ts/npmts.install.ts b/ts/npmts.install.ts index ac60e80..82c7b52 100644 --- a/ts/npmts.install.ts +++ b/ts/npmts.install.ts @@ -1,4 +1,4 @@ -/// +/// import plugins = require("./npmts.plugins"); import paths = require("./npmts.paths"); export var run = function(configArg){ diff --git a/ts/npmts.jsdoc.ts b/ts/npmts.jsdoc.ts index 8cf66e0..e653efc 100644 --- a/ts/npmts.jsdoc.ts +++ b/ts/npmts.jsdoc.ts @@ -43,10 +43,10 @@ var publishDocs = function(configArg){ if(plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish){ plugins.beautylog.log("now publishing docs to GitHub"); if (!plugins.shelljs.which('git')) { - plugins.beautylog.error('Git is not installed'); + plugins.beautylog.error('Git is not installed!'); plugins.shelljs.exit(1); } else if (plugins.shelljs.exec(deployScript).code !== 0) { - plugins.beautylog.error('Error: Git failed'); + plugins.beautylog.error('Git failed!'); plugins.shelljs.exit(1); } plugins.beautylog.ok("JsDoc has been deployed to GitHub!"); diff --git a/ts/npmts.paths.ts b/ts/npmts.paths.ts index 3ab4852..1b6b8e4 100644 --- a/ts/npmts.paths.ts +++ b/ts/npmts.paths.ts @@ -9,6 +9,8 @@ paths.distDir = plugins.path.join(paths.cwd,"dist/"); paths.docsDir = plugins.path.join(paths.cwd,"docs/"); paths.testDir = plugins.path.join(paths.cwd,"test/"); +paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/"); + //Files paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts"); paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts"); diff --git a/ts/npmts.promisechain.ts b/ts/npmts.promisechain.ts index 9ceba6e..3bcdbfe 100644 --- a/ts/npmts.promisechain.ts +++ b/ts/npmts.promisechain.ts @@ -1,17 +1,21 @@ /// import plugins = require("./npmts.plugins"); -import NpmtsConfigFile = require("./npmts.configfile"); -import NpmtsOptions = require("./npmts.options"); -import NpmtsInstall = require("./npmts.install"); + +import NpmtsAssets = require("./npmts.assets"); import NpmtsCompile = require("./npmts.compile"); +import NpmtsConfigFile = require("./npmts.configfile"); +import NpmtsInstall = require("./npmts.install"); import NpmtsJsdoc = require("./npmts.jsdoc"); +import NpmtsOptions = require("./npmts.options"); import NpmtsTests = require("./npmts.tests"); + export var run = function(){ var promisechain; NpmtsConfigFile.run() .then(NpmtsOptions.run) .then(NpmtsInstall.run) .then(NpmtsCompile.run) + .then(NpmtsAssets.run) .then(NpmtsJsdoc.run) .then(NpmtsTests.run) .then(function(configArg){ @@ -29,8 +33,11 @@ export var run = function(){ " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" - console.log(shipString); - plugins.beautylog.success("READY TO SHIP!"); + if (process.env.CI){ + console.log(shipString); + plugins.beautylog.success("READY TO SHIP!"); + } + }); return promisechain; }; \ No newline at end of file