summaryrefslogtreecommitdiff
path: root/spec/outputs/luarocks_upload.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/outputs/luarocks_upload.lua')
-rw-r--r--spec/outputs/luarocks_upload.lua25
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/outputs/luarocks_upload.lua b/spec/outputs/luarocks_upload.lua
index 96988d7..7fa2f73 100644
--- a/spec/outputs/luarocks_upload.lua
+++ b/spec/outputs/luarocks_upload.lua
@@ -12,7 +12,28 @@ if not (version ~= nil) then
12 print("failed to get version!") 12 print("failed to get version!")
13 os.exit(1) 13 os.exit(1)
14end 14end
15local 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}" 15local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp"
16local pkgRoot = tostring(tmpBase) .. "/yuescript_pack_" .. tostring(version)
17local srcDir = tostring(pkgRoot) .. "/yuescript-" .. tostring(version)
18local tarFile = tostring(pkgRoot) .. "/yuescript-" .. tostring(version) .. ".tar.gz"
19local run
20run = function(cmd)
21 print(cmd)
22 local ok = os.execute(cmd)
23 if not (ok == true or ok == 0) then
24 print("Command failed!")
25 return os.exit(1)
26 end
27end
28run("rm -rf '" .. tostring(pkgRoot) .. "'")
29run("mkdir -p '" .. tostring(srcDir) .. "'")
30run("cp CMakeLists.txt '" .. tostring(srcDir) .. "/'")
31run("cp README.md '" .. tostring(srcDir) .. "/'")
32run("cp LICENSE '" .. tostring(srcDir) .. "/'")
33run("cp -R src '" .. tostring(srcDir) .. "/'")
34run("tar -C '" .. tostring(pkgRoot) .. "' -czf '" .. tostring(tarFile) .. "' 'yuescript-" .. tostring(version) .. "'")
35local sourceUrl = "file://" .. tostring(tarFile)
36local rockspec = "rockspec_format = '3.0'\npackage = 'Yuescript'\nversion = '" .. tostring(version) .. "-1'\nsource = {\n url = '" .. tostring(sourceUrl) .. "'\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/IppClub/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 platforms = {\n windows = {\n install = {\n lib = {\n 'build.luarocks/Release/yue.dll'\n },\n bin = {\n 'build.luarocks/Release/yue.exe'\n }\n }\n }\n }\n}"
16local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec" 37local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec"
17do 38do
18 local _with_0 = io.open(specFile, "w+") 39 local _with_0 = io.open(specFile, "w+")
@@ -21,6 +42,8 @@ do
21 _with_0:close() 42 _with_0:close()
22 end 43 end
23end 44end
45print("Using source: " .. tostring(sourceUrl))
46print("Uploading rockspec: " .. tostring(specFile))
24local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a') 47local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a')
25if not result:match("Done:") then 48if not result:match("Done:") then
26 print(result) 49 print(result)