now testing shell

This commit is contained in:
2016-06-05 14:55:08 +02:00
parent 3300f177ca
commit faef4da6be
7 changed files with 65 additions and 22 deletions

View File

@ -1,16 +1,27 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
export let bash = (commandArg) => {
let exitCode = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
).code;
if(exitCode !== 0){
process.exit(1);
if(!process.env.NPMTS_TEST){
let exitCode = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
).code;
if(exitCode !== 0){
process.exit(1);
}
} else {
plugins.beautylog.log("ShellExec would be: " + commandArg.blue)
}
}
export let bashBare = () => {
export let bashBare = (commandArg) => {
if (!process.env.NPMTS_TEST){
let exitCode = plugins.shelljs.exec(commandArg).code;
if(exitCode !== 0){
process.exit(1);
}
} else {
plugins.beautylog.log("ShellExec would be: " + commandArg.blue)
}
}

View File

@ -1,6 +1,6 @@
import * as plugins from "./npmci.plugins"
import * as NpmciEnv from "./npmci.env";
import {bashBare} from "./npmci.bash";
export let build = function(){
let done = plugins.q.defer();
readDockerfiles()
@ -104,7 +104,7 @@ export class Dockerfile {
if(!this.buildTag){
this.patchContents();
let tag = dockerTag(this.repo,this.version);
plugins.shelljs.exec("docker build -t " + tag + " -f " + this.filePath + " .");
bashBare("docker build -t " + tag + " -f " + this.filePath + " .");
this.buildTag = tag;
NpmciEnv.dockerFilesBuilt.push(this);
this.restoreContents();
@ -115,7 +115,7 @@ export class Dockerfile {
};
push(){
if(this.buildTag){
plugins.shelljs.exec("docker push " + this.buildTag);
bashBare("docker push " + this.buildTag);
} else {
plugins.beautylog.error("Dockerfile hasn't been built yet!");
}