diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-03-10 22:45:18 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-03-24 01:18:13 +0200 |
commit | 7d9c43916b0600ac4879dfe9793eab807a83ab2b (patch) | |
tree | ec54ed64c9a557b6ea4ad88d31138a02d3e0cd04 /aconf/loader.lua | |
parent | cb6c243dc356ef1d46d7ddb96e6ea6ae007c6cca (diff) | |
download | aconf-7d9c43916b0600ac4879dfe9793eab807a83ab2b.tar.bz2 aconf-7d9c43916b0600ac4879dfe9793eab807a83ab2b.tar.xz |
rename ACF2 to Alpine Configurator (aconf)
Diffstat (limited to 'aconf/loader.lua')
-rw-r--r-- | aconf/loader.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/aconf/loader.lua b/aconf/loader.lua new file mode 100644 index 0000000..8c58adc --- /dev/null +++ b/aconf/loader.lua @@ -0,0 +1,21 @@ +--[[ +Copyright (c) 2012-2014 Kaarle Ritvanen +See LICENSE file for license details +--]] + +local pth = require('aconf.path') + +local posix = require('posix') +local stringy = require('stringy') + +return function(subdir) + local comps = pth.split('aconf/'..subdir) + local res = {} + for _, modfile in ipairs(posix.dir(pth.join(unpack(comps)))) do + if stringy.endswith(modfile, '.lua') then + local name = modfile:sub(1, -5) + res[name] = require(table.concat(comps, '.')..'.'..name) + end + end + return res + end |