now handling cli option

This commit is contained in:
Philipp Kunz 2016-03-14 04:32:52 +01:00
parent 55d7018891
commit 3ce49c7e97
13 changed files with 68 additions and 20 deletions

16
dist/npmts.assets.js vendored Normal file
View File

@ -0,0 +1,16 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
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;
};

View File

@ -1,5 +1,5 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
/// <reference path="./typings/main.d.ts" />
var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths");
exports.run = function (configArg) {

4
dist/npmts.jsdoc.js vendored
View File

@ -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!");

1
dist/npmts.paths.js vendored
View File

@ -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");

View File

@ -1,11 +1,12 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
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;
};

View File

@ -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"
},

2
test/assets/dist/cli.js vendored Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
var index = require("./index.js");

View File

@ -12,5 +12,6 @@
"coveralls":true,
"docs": {
"publish":true
}
},
"cli":true
}

15
ts/npmts.assets.ts Normal file
View File

@ -0,0 +1,15 @@
/// <reference path="./typings/main.d.ts" />
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;
};

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" />
/// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
export var run = function(configArg){

View File

@ -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!");

View File

@ -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");

View File

@ -1,17 +1,21 @@
/// <reference path="./typings/main.d.ts" />
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;
};