-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboot.lua
executable file
·43 lines (37 loc) · 1.46 KB
/
boot.lua
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env luax
-- This file is part of bang.
--
-- bang is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- bang is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with bang. If not, see <https://www.gnu.org/licenses/>.
--
-- For further information about bang you can visit
-- https://github.com/cdsoft/bang
-- Use the Lua sources of bang to generate the build.ninja file
-- that will be used to compile and test bang...
local fs = require "fs"
-- set Lua search path to load modules that will later live in the bang executable
package.path = "src/?.lua"
-- Load bang libraries that would be automatically loaded by LuaX
local main = nil
fs.ls "src/*.lua" : foreach(function(name)
local content = fs.read(name)
if content:match "@LOAD" then
local mod = name:basename():splitext()
_G[mod] = require(mod)
elseif content:match "@MAIN" then
main = name
end
end)
package.preload.version = function() return "N/A" end
-- Execute the main bang Lua script
dofile(assert(main, "Main script not found"))