diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-11-01 10:15:25 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-11-01 10:15:25 +0800 |
| commit | 701f1fbcba10e0700728dd466778defc784f164d (patch) | |
| tree | 666e472a824e3f9a21eaae710977704750fab664 /spec/outputs | |
| parent | d092bafc74a851939925ec2d40a8bd364b607d68 (diff) | |
| download | yuescript-701f1fbcba10e0700728dd466778defc784f164d.tar.gz yuescript-701f1fbcba10e0700728dd466778defc784f164d.tar.bz2 yuescript-701f1fbcba10e0700728dd466778defc784f164d.zip | |
add luarocks upload. [skip CI]
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/luarocks_upload.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/outputs/luarocks_upload.lua b/spec/outputs/luarocks_upload.lua new file mode 100644 index 0000000..96988d7 --- /dev/null +++ b/spec/outputs/luarocks_upload.lua | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | local luarocksKey = ... | ||
| 2 | local version | ||
| 3 | do | ||
| 4 | local _with_0 = io.open("src/yuescript/yue_compiler.cpp") | ||
| 5 | if _with_0 ~= nil then | ||
| 6 | local codes = _with_0:read("*a") | ||
| 7 | _with_0:close() | ||
| 8 | version = codes:match("const std::string_view version = \"(.-)\"sv;") | ||
| 9 | end | ||
| 10 | end | ||
| 11 | if not (version ~= nil) then | ||
| 12 | print("failed to get version!") | ||
| 13 | os.exit(1) | ||
| 14 | end | ||
| 15 | local rockspec = "rockspec_format = '3.0'\npackage = 'Yuescript'\nversion = '" .. tostring(version) .. "-1'\nsource = {\n url = 'git+https://github.com/pigpigyyy/yuescript'\n}\ndescription = {\n summary = 'Yuescript is a Moonscript dialect.',\n detailed = [[\n Yuescript is a Moonscript dialect. It is derived from Moonscript language 0.5.0 and continuously adopting new features to be more up to date. ]],\n homepage = 'https://github.com/pigpigyyy/yuescript',\n maintainer = 'Li Jin <dragon-fly@qq.com>',\n labels = {'yuescript','cpp','transpiler','moonscript'},\n license = 'MIT'\n}\ndependencies = {\n 'lua >= 5.1',\n}\nbuild = {\n type = 'cmake',\n variables = {\n LUA='$(LUA)',\n LUA_INCDIR='$(LUA_INCDIR)',\n CMAKE_BUILD_TYPE='Release'\n },\n install = {\n lib = {\n 'build.luarocks/yue.so'\n },\n bin = {\n 'build.luarocks/yue'\n }\n }\n}" | ||
| 16 | local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec" | ||
| 17 | do | ||
| 18 | local _with_0 = io.open(specFile, "w+") | ||
| 19 | if _with_0 ~= nil then | ||
| 20 | _with_0:write(rockspec) | ||
| 21 | _with_0:close() | ||
| 22 | end | ||
| 23 | end | ||
| 24 | local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a') | ||
| 25 | if not result:match("Done:") then | ||
| 26 | print(result) | ||
| 27 | return os.exit(1) | ||
| 28 | end | ||
