summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-24 17:01:19 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-24 17:01:25 +0100
commitfb6018f379bb4b3e200b0ca75f3c0efba15ddf48 (patch)
treee0ae0b76fae8542d6ce0cb5d916ff64a6ee90b75 /lib
parentc1d21775ed856054b57cc983c1f3be8125ab0e06 (diff)
downloadgitano-fb6018f379bb4b3e200b0ca75f3c0efba15ddf48.tar.gz
Fix up simple_match to remove legacy operation
Diffstat (limited to 'lib')
-rw-r--r--lib/gitano/lace.lua30
1 files changed, 7 insertions, 23 deletions
diff --git a/lib/gitano/lace.lua b/lib/gitano/lace.lua
index 7642135..472502c 100644
--- a/lib/gitano/lace.lua
+++ b/lib/gitano/lace.lua
@@ -2,7 +2,7 @@
--
-- Interface to Lace for rules management
--
--- Copyright 2012 Daniel Silverstone <dsilvers@digital-scurf.org>
+-- Copyright 2012-2016 Daniel Silverstone <dsilvers@digital-scurf.org>
local lace = require 'lace'
local util = require 'gitano.util'
@@ -18,10 +18,10 @@ local function generate_automatics(ctx)
local config = ctx.repo.config
local automatics = {}
for u in pairs(config.users) do
- automatics["user_" .. flatten_name(u)] = "user " .. u
+ automatics["user_" .. flatten_name(u)] = "user exact " .. u
end
for g in pairs(config.groups) do
- automatics["group_" .. flatten_name(g)] = "group " .. g
+ automatics["group_" .. flatten_name(g)] = "group exact " .. g
end
local ret = {}
for k, v in pairs(automatics) do
@@ -75,7 +75,7 @@ local function _loader(ctx, _name)
if not tree[blob_name] or tree[blob_name].type ~= "blob" then
local m = ("Unable to find %s in %s (%s)"):format(blob_name, sha, _name)
log.ddebug(m)
- return lace.compiler.error(m)
+ return lace.error.error(m)
end
--log.ddebug("Lace->Loading", real_name)
return real_name, tree[blob_name].obj.content
@@ -134,29 +134,13 @@ end
local function _simple_match(ctx, key, matchtype, value, guard)
if guard ~= nil then
- return lace.compiler.error("Unexpected additional argument", {4})
+ return lace.error.error("Unexpected additional argument", {4})
end
if value == nil then
- matchtype, value = "", matchtype
- local sigil, _value = value:match("^(.)(.*)$")
- if sigil == "!" then
- inv = true
- matchtype = "!"
- value = _value
- end
- sigil, _value = value:match("^(.)(.*)$")
- if sigil == "=" then
- matchtype = matchtype .. "exact"
- value = _value
- elseif sigil == "~" then
- matchtype = matchtype .. "pattern"
- value = _value
- else
- matchtype = matchtype .. "exact"
- end
+ return lace.error.error("Missing matchtype or value", {1})
end
if match_types[matchtype] == nil then
- return lace.compiler.error("Unknown match type", {2})
+ return lace.error.error("Unknown match type", {2})
end
return {
fn = _do_simple_match,