start shift to making bare bash obsolete

This commit is contained in:
Philipp Kunz 2016-08-02 16:20:32 +02:00
parent 236df3388f
commit 2d9c225d28
17 changed files with 83 additions and 39 deletions

View File

@ -1,3 +1,4 @@
import "typings-global";
export declare let nvmAvailable: boolean;
export declare let bash: (commandArg: string, retryArg?: number, bareArg?: boolean) => string;
export declare let bashBare: (commandArg: any, retryArg?: number) => string;

16
dist/npmci.bash.js vendored
View File

@ -1,6 +1,16 @@
"use strict";
require("typings-global");
const plugins = require("./npmci.plugins");
let nvmSourceString = "";
exports.nvmAvailable = false;
let checkNvm = () => {
let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code;
if (nvmExecCode === 0) {
nvmSourceString = `source /usr/local/nvm/nvm.sh && `;
exports.nvmAvailable = true;
}
};
checkNvm();
exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
let exitCode;
let stdOut;
@ -8,9 +18,7 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
if (!process.env.NPMTS_TEST) {
for (let i = 0; i <= retryArg; i++) {
if (!bareArg) {
execResult = plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\"");
execResult = plugins.shelljs.exec(`bash -c "${nvmSourceString} ${commandArg}"`);
}
else {
execResult = plugins.shelljs.exec(commandArg);
@ -37,4 +45,4 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
exports.bashBare = (commandArg, retryArg = 2) => {
return exports.bash(commandArg, retryArg, true);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFB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BQyxRQUFRLEdBQUcsQ0FBQztJQUMxQyxNQUFNLENBQUMsWUFBSSxDQUFDLFVBQVUsRUFBQyxRQUFRLEVBQUMsSUFBSSxDQUFDLENBQUM7QUFDMUMsQ0FBQyxDQUFBIn0=

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let build: (commandArg: any) => any;
import * as plugins from "./npmci.plugins";
export declare let build: (commandArg: any) => plugins.q.Promise<{}>;

View File

@ -1,12 +1,14 @@
/// <reference types="q" />
/// <reference types="node" />
export declare let build: () => any;
export declare let readDockerfiles: () => any;
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => any;
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => any;
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => any;
export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
import * as plugins from "./npmci.plugins";
export declare let build: () => plugins.q.Promise<{}>;
export declare let readDockerfiles: () => plugins.q.Promise<{}>;
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => plugins.q.Promise<{}>;
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => plugins.q.Promise<{}>;
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>;
export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>;
export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => plugins.q.Promise<{}>;
export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>;
export declare class Dockerfile {
filePath: string;
repo: string;
@ -25,8 +27,8 @@ export declare class Dockerfile {
fileContents?: string | Buffer;
read?: boolean;
});
build(): any;
push(stageArg: any): any;
build(): plugins.q.Promise<{}>;
push(stageArg: any): plugins.q.Promise<{}>;
pull(registryArg: string): void;
test(): void;
getId(): string;

View File

@ -1,5 +1,7 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
/**
* cleans npmci config files
*/
export declare let clean: () => any;
export declare let clean: () => plugins.q.Promise<{}>;

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let command: () => any;
import * as plugins from "./npmci.plugins";
export declare let command: () => plugins.q.Promise<{}>;

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let install: (versionArg: any) => any;
import * as plugins from "./npmci.plugins";
export declare let install: (versionArg: any) => plugins.q.Promise<{}>;

View File

@ -5,9 +5,9 @@ export declare let gulpFunction: any;
export declare let lodash: any;
export import path = require("path");
export import projectinfo = require("projectinfo");
export declare let q: any;
export import q = require("q");
export declare let request: any;
export declare let shelljs: any;
export import shelljs = require("shelljs");
export import smartcli = require("smartcli");
export import smartfile = require("smartfile");
export import smartparam = require("smartparam");

View File

@ -15,4 +15,4 @@ exports.smartparam = require("smartparam");
exports.smartssh = require("smartssh");
exports.smartstring = require("smartstring");
exports.through2 = require("through2");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixvQkFBWSxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN4QyxjQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQ3hCLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2Q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T0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGVBQU8sV0FBVyxTQUFTLENBQUMsQ0FBQztBQUM3QixnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsa0JBQVUsV0FBVyxZQUFZLENBQUMsQ0FBQztBQUNuQyxnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLG1CQUFXLFdBQVcsYUFBYSxDQUFDLENBQUM7QUFDeEMsZ0JBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUMifQ==

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let prepare: (serviceArg: string) => any;
import * as plugins from "./npmci.plugins";
export declare let prepare: (serviceArg: string) => plugins.q.Promise<{}>;

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let publish: (serviceArg?: string) => any;
import * as plugins from "./npmci.plugins";
export declare let publish: (serviceArg?: string) => plugins.q.Promise<{}>;

4
dist/npmci.ssh.d.ts vendored
View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let ssh: () => any;
import * as plugins from "./npmci.plugins";
export declare let ssh: () => plugins.q.Promise<{}>;

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let test: (versionArg: any) => any;
import * as plugins from "./npmci.plugins";
export declare let test: (versionArg: any) => plugins.q.Promise<{}>;

View File

@ -1,2 +1,4 @@
/// <reference types="q" />
import "typings-global";
export declare let trigger: () => any;
import * as plugins from "./npmci.plugins";
export declare let trigger: () => plugins.q.Promise<{}>;

View File

@ -3,6 +3,7 @@
"version": "2.3.12",
"description": "",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"bin": {
"npmci": "dist/index.js"
},
@ -21,21 +22,25 @@
},
"homepage": "https://gitlab.com/pushrocks/npmci#README",
"devDependencies": {
"npmts-g": "^5.2.6",
"npmts-g": "^5.2.8",
"should": "^10.0.0",
"typings-test": "^1.0.1"
},
"dependencies": {
"beautylog": "^5.0.14",
"@types/lodash": "^0.0.28",
"@types/q": "^0.0.27",
"@types/request": "^0.0.27",
"@types/shelljs": "^0.3.27",
"beautylog": "^5.0.18",
"gulp": "^3.9.1",
"gulp-function": "^1.3.6",
"lodash": "^4.13.1",
"lodash": "^4.14.1",
"projectinfo": "^1.0.3",
"q": "^1.4.1",
"request": "^2.73.0",
"shelljs": "^0.7.0",
"request": "^2.74.0",
"shelljs": "^0.7.3",
"smartcli": "^1.0.4",
"smartfile": "^4.0.11",
"smartfile": "^4.0.12",
"smartparam": "^0.1.1",
"smartssh": "^1.1.5",
"smartstring": "^2.0.15",

View File

@ -1,17 +1,27 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
let nvmSourceString:string = "";
export let nvmAvailable:boolean = false;
let checkNvm = () => {
let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code;
if(nvmExecCode === 0){
nvmSourceString = `source /usr/local/nvm/nvm.sh && `
nvmAvailable = true;
}
};
checkNvm();
export let bash = (commandArg:string,retryArg = 2,bareArg = false) => {
let exitCode:number;
let stdOut:string;
let execResult;
if(!process.env.NPMTS_TEST){
if(!process.env.NPMTS_TEST){ // NPMTS_TEST is used during testing
for (let i = 0; i <= retryArg; i++){
if(!bareArg){
execResult = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
`bash -c "${nvmSourceString} ${commandArg}"`
);
} else {
execResult = plugins.shelljs.exec(commandArg);

View File

@ -5,9 +5,9 @@ export let gulpFunction = require("gulp-function");
export let lodash = require("lodash");
export import path = require("path");
export import projectinfo = require("projectinfo");
export let q = require("q");
export import q = require("q");
export let request = require("request");
export let shelljs = require("shelljs");
export import shelljs = require("shelljs");
export import smartcli = require("smartcli");
export import smartfile = require("smartfile");
export import smartparam = require("smartparam");