diff options
Diffstat (limited to 'spec/outputs/luarocks_upload.lua')
| -rw-r--r-- | spec/outputs/luarocks_upload.lua | 25 |
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) |
| 14 | end | 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}" | 15 | local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp" |
| 16 | local pkgRoot = tostring(tmpBase) .. "/yuescript_pack_" .. tostring(version) | ||
| 17 | local srcDir = tostring(pkgRoot) .. "/yuescript-" .. tostring(version) | ||
| 18 | local tarFile = tostring(pkgRoot) .. "/yuescript-" .. tostring(version) .. ".tar.gz" | ||
| 19 | local run | ||
| 20 | run = 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 | ||
| 27 | end | ||
| 28 | run("rm -rf '" .. tostring(pkgRoot) .. "'") | ||
| 29 | run("mkdir -p '" .. tostring(srcDir) .. "'") | ||
| 30 | run("cp CMakeLists.txt '" .. tostring(srcDir) .. "/'") | ||
| 31 | run("cp README.md '" .. tostring(srcDir) .. "/'") | ||
| 32 | run("cp LICENSE '" .. tostring(srcDir) .. "/'") | ||
| 33 | run("cp -R src '" .. tostring(srcDir) .. "/'") | ||
| 34 | run("tar -C '" .. tostring(pkgRoot) .. "' -czf '" .. tostring(tarFile) .. "' 'yuescript-" .. tostring(version) .. "'") | ||
| 35 | local sourceUrl = "file://" .. tostring(tarFile) | ||
| 36 | local 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}" | ||
| 16 | local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec" | 37 | local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec" |
| 17 | do | 38 | do |
| 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 |
| 23 | end | 44 | end |
| 45 | print("Using source: " .. tostring(sourceUrl)) | ||
| 46 | print("Uploading rockspec: " .. tostring(specFile)) | ||
| 24 | local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a') | 47 | local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a') |
| 25 | if not result:match("Done:") then | 48 | if not result:match("Done:") then |
| 26 | print(result) | 49 | print(result) |
