init
This commit is contained in:
parent
94c97dd78b
commit
4592383666
|
@ -0,0 +1,13 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 3
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"cSpell.words": ["libdir", "luadir", "luarocks", "rockspec"],
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"files.associations": {
|
||||
".busted": "lua",
|
||||
".luacheckrc": "lua",
|
||||
".luacov": "lua",
|
||||
"*.rockspec": "lua"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package = "luarocks-build-teal"
|
||||
version = "dev-1"
|
||||
source = {
|
||||
url = "*** please add URL for source tarball, zip or repository here ***"
|
||||
}
|
||||
description = {
|
||||
summary = "A LuaRocks build backend for Teal modules",
|
||||
detailed = "A LuaRocks build backend for Teal modules",
|
||||
homepage = "*** please enter a project homepage ***",
|
||||
license = "*** please specify a license ***"
|
||||
}
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
["luarocks.build.teal"] = "src/luarocks/build/teal.lua"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
local dir = require("luarocks.dir")
|
||||
local fs = require("luarocks.fs")
|
||||
local path = require("luarocks.path")
|
||||
|
||||
-- TODO : require cyan + check if it's available
|
||||
|
||||
local build_teal = {}
|
||||
|
||||
--- Driver function for the "teal" build back-end.
|
||||
-- @param rockspec table: The loaded rockspec.
|
||||
-- @return boolean or (nil, string): true if no errors occurred,
|
||||
-- nil and an error message otherwise.
|
||||
function build_teal.run(rockspec, no_install)
|
||||
assert(rockspec:type() == "rockspec")
|
||||
|
||||
if not fs.is_tool_available("cyan", "Cyan") then
|
||||
return nil, "'cyan' is not installed."
|
||||
end
|
||||
|
||||
-- TODO : use the cyan API
|
||||
if not fs.execute("cyan build") then
|
||||
return nil, "Failed building."
|
||||
end
|
||||
|
||||
if rockspec.build and rockspec.build.modules and not no_install then
|
||||
local luadir = path.lua_dir(rockspec.name, rockspec.version)
|
||||
fs.make_dir(dir.dir_name(luadir))
|
||||
|
||||
-- TODO : get the build dir from .tlconfig
|
||||
local target_path = rockspec.build.target_path or "build"
|
||||
|
||||
for mod, target in pairs(rockspec.build.modules) do
|
||||
|
||||
local src = dir.path(target_path, target)
|
||||
local dst = dir.path(luadir, path.module_to_path(mod) .. "init.lua")
|
||||
|
||||
fs.make_dir(dir.dir_name(dst))
|
||||
local ok, err = fs.copy(src, dst, "exec")
|
||||
if not ok then
|
||||
return nil, "Failed installing " .. src .. " in " .. dst .. ": " .. err
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return build_teal
|
Loading…
Reference in New Issue