Fixed behavior of multi-step builds.

* Output from the main strawboss executable is properly directed to stdout
  and stderr.
* Added threshold logging to strawboss core functions.
* Fixed a bug in the way dependent steps were detected and executed.
  The logic for checking if prior steps had already been executed was only
  executed once when the initial step was prepared, not for any of the
  dependent steps. This logic has been moved into the main work block for
  executing steps.
* Renamed `initiateRun` to `run` and  `runStep` to `doRun` to be more accurate.
* Dependent steps get their owng, independent copy of the workspace.
* Updated the test project to provide a test target.
This commit is contained in:
Jonathan Bernard
2017-11-24 20:29:41 -06:00
parent 573903bda0
commit 58fbbc048c
8 changed files with 134 additions and 66 deletions

View File

@ -1,4 +1,4 @@
import cliutils, logging, json, os, sequtils, strtabs, tables, times, uuids
import cliutils, logging, json, os, sequtils, strtabs, strutils, tables, times, uuids
from langutils import sameContents
from typeinfo import toAny
@ -52,6 +52,7 @@ type
authSecret*: string
filePath*: string
debug*: bool
logLevel*: Level
pathToExe*: string
projects*: seq[ProjectDef]
pwdCost*: int8
@ -79,6 +80,7 @@ proc `==`*(a, b: StrawBossConfig): bool =
a.authSecret == b.authSecret and
a.pwdCost == b.pwdCost and
a.maintenancePeriod == b.maintenancePeriod and
a.logLevel == b.logLevel and
sameContents(a.users, b.users) and
sameContents(a.projects, b.projects)
@ -111,6 +113,10 @@ proc getOrFail(n: JsonNode, key: string, objName: string = ""): JsonNode =
# Configuration parsing code
proc parseLogLevel*(level: string): Level =
let lvlStr = "lvl" & toUpper(level[0]) & level[1..^1]
result = parseEnum[Level](lvlStr)
proc parseProjectDef*(pJson: JsonNode): ProjectDef =
var envVars = newStringTable(modeCaseSensitive)
for k, v in pJson.getIfExists("envVars").getFields: envVars[k] = v.getStr("")
@ -137,6 +143,7 @@ proc parseStrawBossConfig*(jsonCfg: JsonNode): StrawBossConfig =
pwdCost: int8(jsonCfg.getOrFail("pwdCost", "strawboss config").getNum),
projects: jsonCfg.getIfExists("projects").getElems.mapIt(parseProjectDef(it)),
maintenancePeriod: int(jsonCfg.getIfExists("maintenancePeriod").getNum(10000)),
logLevel: parseLogLevel(jsonCfg.getIfExists("logLevel").getStr("lvlInfo")),
users: users)
@ -271,6 +278,7 @@ proc `%`*(cfg: StrawBossConfig): JsonNode =
"projects": %cfg.projects,
"pwdCost": cfg.pwdCost,
"maintenancePeriod": cfg.maintenancePeriod,
"logLevel": cfg.logLevel,
"users": %cfg.users }
proc `%`*(run: Run): JsonNode =