diff options
author | Richard Maw <richard.maw@gmail.com> | 2017-01-08 14:59:25 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2017-01-08 15:01:29 +0000 |
commit | c9c0d3d997bf878164d9123743363d23e789932a (patch) | |
tree | 55a42e15dc4457d3016f1344ffe8df853b53193e /lib | |
parent | 17284b8e42da5a359f06dd4b56488914a008c1c4 (diff) | |
download | gitano-c9c0d3d997bf878164d9123743363d23e789932a.tar.gz |
testing: Add a way to extract variables from the test suite
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitano/repository.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitano/repository.lua b/lib/gitano/repository.lua index 7858a33..e48267f 100644 --- a/lib/gitano/repository.lua +++ b/lib/gitano/repository.lua @@ -165,6 +165,29 @@ end function repo_method:run_lace(context) self:populate_context(context) config.populate_context(self.config, context) + local vardump = luxio.getenv("GITANO_DUMP_VARIABLE_FILE") + if vardump then + local io = require "io" + local pretty = require "pl.pretty" + local t + local fh = io.open(vardump, "r") + if not fh then + t = {} + else + t = pretty.read(fh:read("*a")) + fh:close() + end + local op = context.operation + for k, _ in pairs(context) do + if not t[k] then + t[k] = {} + end + t[k][op] = true + end + local fh = io.open(vardump, "w+") + fh:write(pretty.write(t)) + fh:close() + end return lace.run(self.lace, context) end |