From 52eaa63f250c32f2da1755af1f2c429996aa4af5 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 23 Dec 2018 17:39:04 -0600 Subject: [PATCH] Rework build configuration to take advantage of new built-in docker build capabilities. --- src/main/nim/strawboss.nim | 5 ++--- src/main/nim/strawbosspkg/server.nim | 6 +++--- src/main/nim/strawbosspkg/version.nim | 2 ++ strawboss.projectdef.json | 16 +++++++++------- 4 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 src/main/nim/strawbosspkg/version.nim diff --git a/src/main/nim/strawboss.nim b/src/main/nim/strawboss.nim index bd36aa6..ef0f9a1 100644 --- a/src/main/nim/strawboss.nim +++ b/src/main/nim/strawboss.nim @@ -3,8 +3,7 @@ import cliutils, docopt, os, sequtils, strutils, tempfile, uuids import strawbosspkg/configuration import strawbosspkg/core import strawbosspkg/server - -let SB_VER = "0.5.0" +import strawbosspkg/version proc logProcOutput*(outMsg, errMsg: TaintedString, cmd: string) = let prefix = if cmd.len > 0: cmd & ": " else: "" @@ -26,7 +25,7 @@ Options (strawboss.config.json). """ - let args = docopt(doc, version = "strawboss v" & SB_VER) + let args = docopt(doc, version = "strawboss v" & SB_VERSION) let cfgFile = if args["--config-file"]: $args["--config-file"] else: "strawboss.config.json" diff --git a/src/main/nim/strawbosspkg/server.nim b/src/main/nim/strawbosspkg/server.nim index 0ea4d50..60993c1 100644 --- a/src/main/nim/strawbosspkg/server.nim +++ b/src/main/nim/strawbosspkg/server.nim @@ -7,7 +7,7 @@ from asyncnet import send from re import re, find from timeutils import trimNanoSec -import ./configuration, ./core +import ./configuration, ./core, ./version type Session = object @@ -166,8 +166,8 @@ proc start*(cfg: StrawBossConfig): void = routes: - get "/ping": - resp($(%"pong"), JSON) + get "/version": + resp($(%("strawboss v" & SB_VERSION)), JSON) post "/auth-token": var uname, pwd: string diff --git a/src/main/nim/strawbosspkg/version.nim b/src/main/nim/strawbosspkg/version.nim new file mode 100644 index 0000000..e9037a8 --- /dev/null +++ b/src/main/nim/strawbosspkg/version.nim @@ -0,0 +1,2 @@ +const SB_VERSION* = "0.5.0" + diff --git a/strawboss.projectdef.json b/strawboss.projectdef.json index 380c818..497aeb5 100644 --- a/strawboss.projectdef.json +++ b/strawboss.projectdef.json @@ -1,24 +1,26 @@ { "name": "strawboss", + "containerImage": "nimlang/nim:0.19.0", "steps": { "compile": { "artifacts": ["strawboss"], - "stepCmd": "docker run -v `pwd`:/usr/src/strawboss -w /usr/src/strawboss jdbernard/nim:0.17.2 nimble install" + "containerImage": "nimlang/nim:0.19.0", + "stepCmd": "nimble build" }, "unittest": { "depends": ["compile"], - "stepCmd": "docker run -v `pwd`:/usr/src/strawboss -v $compile_DIR:/usr/build/strawboss -w /usr/src/strawboss -i jdbernard/nim:0.17.2 /bin/bash", + "stepCmd": "/bin/bash", "cmdInput": [ - "cp /usr/build/strawboss/strawboss .", + "cp $compile_DIR/strawboss .", "nimble install --depsOnly", "nim c -r src/test/nim/run_unit_tests" ] }, "functest": { "depends": ["compile"], - "stepCmd": "docker run -v `pwd`:/usr/src/strawboss -v $compile_DIR:/usr/build/strawboss -w /usr/src/strawboss -i jdbernard/nim:0.17.2 /bin/bash", + "stepCmd": "/bin/bash", "cmdInput": [ - "cp /usr/build/strawboss/strawboss .", + "cp $compile_DIR/strawboss .", "nimble install --depsOnly", "nim c -r src/test/nim/run_functional_tests" ] @@ -26,9 +28,9 @@ "build": { "artifacts": ["strawboss-$VERSION.zip"], "depends": ["compile", "unittest", "functest"], - "stepCmd": "docker run -v `pwd`:/usr/src/strawboss -v $compile_DIR:/usr/build/strawboss -w /usr/src/strawboss -i jdbernard/nim:0.17.2 /bin/bash", + "stepCmd": "/bin/bash", "cmdInput": [ - "cp /usr/build/strawboss/strawboss .", + "cp $compile_DIR/strawboss .", "zip strawboss-$VERSION.zip strawboss strawboss.config.json example.json src/main/systemd/strawboss.service" ] }