summaryrefslogtreecommitdiff
path: root/server/src/async/scanfiles.lua
blob: f53564f853a3a738992d797e5dfb02015be3fcea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local args = ...

require 'utility'
local fs = require 'bee.filesystem'
local ignore = { '.git', 'node_modules' }

local root = fs.absolute(fs.path(args.root))
for name in pairs(args.ignore) do
    ignore[#ignore+1] = name
end
for i, name in ipairs(ignore) do
    ignore[i] = root / name
end

for path in io.scan(root, ignore) do
    if path:extension():string() == '.lua' then
        local buf = io.load(path)
        if buf then
            OUT:push {
                path = fs.absolute(path):string(),
                buf = buf,
            }
        end
    end
end

OUT:push 'ok'