From 9d092aa280d7a7402e3e3516db93a2c022c8ea4d Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sat, 4 Jun 2016 18:41:35 +0200 Subject: [PATCH] restructure some commands --- ts/npmci.build.docker.ts | 10 ++++++++++ ts/npmci.build.ts | 10 +++------- ts/npmci.env.ts | 22 +--------------------- ts/npmci.tag.docker.ts | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 ts/npmci.build.docker.ts create mode 100644 ts/npmci.tag.docker.ts diff --git a/ts/npmci.build.docker.ts b/ts/npmci.build.docker.ts new file mode 100644 index 0000000..dfe4ece --- /dev/null +++ b/ts/npmci.build.docker.ts @@ -0,0 +1,10 @@ +import * as plugins from "./npmci.plugins" +import * as env from "./npmci.env"; +import {tagDocker} from ".npmci.tag"; +export let build = function(){ + let done = plugins.q.defer(); + done.resolve(); + return done.promise; +} + +let getDockerFiles \ No newline at end of file diff --git a/ts/npmci.build.ts b/ts/npmci.build.ts index feab24b..34c24c2 100644 --- a/ts/npmci.build.ts +++ b/ts/npmci.build.ts @@ -2,18 +2,14 @@ import "typings-global"; import * as plugins from "./npmci.plugins"; import {bash} from "./npmci.bash"; import * as env from "./npmci.env"; +import * as buildDocker from "./npmci.build.docker" export let build = function(commandArg){ switch(commandArg){ case "docker": - return docker(); + return buildDocker.build(); } } -let docker = function(){ - let done = plugins.q.defer(); - plugins.shelljs.exec("docker build -t " + env.dockerTag()); - done.resolve(); - return done.promise; -} + diff --git a/ts/npmci.env.ts b/ts/npmci.env.ts index b975a6a..f3f0c44 100644 --- a/ts/npmci.env.ts +++ b/ts/npmci.env.ts @@ -7,24 +7,4 @@ export let repo = new GitRepo(process.env.CI_BUILD_REPO); export let dockerTestTag:string; export let dockerReleaseTag:string; -export let dockerRegistry = "docker.io"; // will be set by npmci.prepare - -export let dockerTagVersion = function(){ - if(process.env.CI_BUILD_STAGE == "test"){ - return "test"; - } else { - return "latest" - } -} - -export let dockerTag = function(){ - return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":" + dockerTagVersion() +" ."; -} - -export let dockerTagTest = function(){ - return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":test ."; -} - -export let dockerTagRelease = function(){ - return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":latest ."; -} +export let dockerRegistry = "docker.io"; // will be set by npmci.prepare \ No newline at end of file diff --git a/ts/npmci.tag.docker.ts b/ts/npmci.tag.docker.ts new file mode 100644 index 0000000..9874e36 --- /dev/null +++ b/ts/npmci.tag.docker.ts @@ -0,0 +1,22 @@ +import "typings-global"; +import * as plugins from "./npmci.plugins"; +import * as env from "./npmci.env"; +export let dockerTagVersion = function(){ + if(process.env.CI_BUILD_STAGE == "test"){ + return "test"; + } else { + return "latest" + } +} + +export let dockerTag = function(){ + return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":" + dockerTagVersion() +" ."; +} + +export let dockerTagTest = function(){ + return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":test ."; +} + +export let dockerTagRelease = function(){ + return dockerRegistry + "/" + repo.user + "/" + repo.repo + ":latest ."; +} \ No newline at end of file