From 0f75a9573821933f7829d250a99fcfa353ab7518 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sun, 22 Feb 2026 02:10:26 +0800 Subject: Fixed some scripts. Fix. --- spec/inputs/compile_doc.yue | 2 +- spec/inputs/luarocks_upload.yue | 64 +++++++++++++++++++++++++++++++++++++--- spec/outputs/compile_doc.lua | 2 +- spec/outputs/luarocks_upload.lua | 25 +++++++++++++++- yuescript-dev-1.rockspec | 5 ++-- 5 files changed, 88 insertions(+), 10 deletions(-) diff --git a/spec/inputs/compile_doc.yue b/spec/inputs/compile_doc.yue index f6a8d49..34f810c 100644 --- a/spec/inputs/compile_doc.yue +++ b/spec/inputs/compile_doc.yue @@ -35,7 +35,7 @@ getFiles = (locale) -> "doc/docs/#{locale}doc/language-basics/literals.md" "doc/docs/#{locale}doc/language-basics/module.md" "doc/docs/#{locale}doc/reference/license-mit.md" - "doc/docs/#{locale}doc/reference/the-yuescript-library.md" + "doc/docs/#{locale}doc/advanced/the-yuescript-library.md" ] docs = [ ["codes_from_doc_#{locale}.lua", "yue-#{locale}.md", getFiles locale] for locale in *["en", "zh", "pt-br", "de", "id-id"]] for [compiledFile, docFile, docFiles] in *docs diff --git a/spec/inputs/luarocks_upload.yue b/spec/inputs/luarocks_upload.yue index 30e8434..8409484 100644 --- a/spec/inputs/luarocks_upload.yue +++ b/spec/inputs/luarocks_upload.yue @@ -1,4 +1,5 @@ luarocksKey = ... + local version with? io.open "src/yuescript/yue_compiler.cpp" codes = \read "*a" @@ -8,17 +9,52 @@ unless version? print "failed to get version!" os.exit 1 +-- ============================== +-- 1. Prepare minimal source tree +-- ============================== + +local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp" +local pkgRoot = "#{tmpBase}/yuescript_pack_#{version}" +local srcDir = "#{pkgRoot}/yuescript-#{version}" +local tarFile = "#{pkgRoot}/yuescript-#{version}.tar.gz" + +run = (cmd) -> + print cmd + ok = os.execute cmd + unless ok == true or ok == 0 + print "Command failed!" + os.exit 1 + +-- clean & create +run "rm -rf '#{pkgRoot}'" +run "mkdir -p '#{srcDir}'" + +-- copy whitelist files +run "cp CMakeLists.txt '#{srcDir}/'" +run "cp README.md '#{srcDir}/'" +run "cp LICENSE '#{srcDir}/'" +run "cp -R src '#{srcDir}/'" + +-- create tar.gz +run "tar -C '#{pkgRoot}' -czf '#{tarFile}' 'yuescript-#{version}'" + +local sourceUrl = "file://#{tarFile}" + +-- ========================= +-- 2. Generate rockspec +-- ========================= + rockspec = "rockspec_format = '3.0' package = 'Yuescript' version = '#{version}-1' source = { - url = 'git+https://github.com/pigpigyyy/yuescript' + url = '#{sourceUrl}' } description = { summary = 'Yuescript is a Moonscript dialect.', detailed = [[ 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. ]], - homepage = 'https://github.com/pigpigyyy/yuescript', + homepage = 'https://github.com/IppClub/YueScript', maintainer = 'Li Jin ', labels = {'yuescript','cpp','transpiler','moonscript'}, license = 'MIT' @@ -29,8 +65,8 @@ dependencies = { build = { type = 'cmake', variables = { - LUA='$(LUA)', - LUA_INCDIR='$(LUA_INCDIR)', + LUA = '$(LUA)', + LUA_INCDIR = '$(LUA_INCDIR)', CMAKE_BUILD_TYPE='Release' }, install = { @@ -40,14 +76,34 @@ build = { bin = { 'build.luarocks/yue' } + }, + platforms = { + windows = { + install = { + lib = { + 'build.luarocks/Release/yue.dll' + }, + bin = { + 'build.luarocks/Release/yue.exe' + } + } + } } }" specFile = "yuescript-#{version}-1.rockspec" + with? io.open specFile, "w+" \write rockspec \close! +print "Using source: #{sourceUrl}" +print "Uploading rockspec: #{specFile}" + +-- ========================= +-- 3. Upload +-- ========================= + result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a' unless result\match "Done:" print result diff --git a/spec/outputs/compile_doc.lua b/spec/outputs/compile_doc.lua index f661bbd..470257d 100644 --- a/spec/outputs/compile_doc.lua +++ b/spec/outputs/compile_doc.lua @@ -45,7 +45,7 @@ getFiles = function(locale) "doc/docs/" .. tostring(locale) .. "doc/language-basics/literals.md", "doc/docs/" .. tostring(locale) .. "doc/language-basics/module.md", "doc/docs/" .. tostring(locale) .. "doc/reference/license-mit.md", - "doc/docs/" .. tostring(locale) .. "doc/reference/the-yuescript-library.md" + "doc/docs/" .. tostring(locale) .. "doc/advanced/the-yuescript-library.md" } end local docs 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 print("failed to get version!") os.exit(1) end -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 ',\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}" +local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp" +local pkgRoot = tostring(tmpBase) .. "/yuescript_pack_" .. tostring(version) +local srcDir = tostring(pkgRoot) .. "/yuescript-" .. tostring(version) +local tarFile = tostring(pkgRoot) .. "/yuescript-" .. tostring(version) .. ".tar.gz" +local run +run = function(cmd) + print(cmd) + local ok = os.execute(cmd) + if not (ok == true or ok == 0) then + print("Command failed!") + return os.exit(1) + end +end +run("rm -rf '" .. tostring(pkgRoot) .. "'") +run("mkdir -p '" .. tostring(srcDir) .. "'") +run("cp CMakeLists.txt '" .. tostring(srcDir) .. "/'") +run("cp README.md '" .. tostring(srcDir) .. "/'") +run("cp LICENSE '" .. tostring(srcDir) .. "/'") +run("cp -R src '" .. tostring(srcDir) .. "/'") +run("tar -C '" .. tostring(pkgRoot) .. "' -czf '" .. tostring(tarFile) .. "' 'yuescript-" .. tostring(version) .. "'") +local sourceUrl = "file://" .. tostring(tarFile) +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 ',\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}" local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec" do local _with_0 = io.open(specFile, "w+") @@ -21,6 +42,8 @@ do _with_0:close() end end +print("Using source: " .. tostring(sourceUrl)) +print("Uploading rockspec: " .. tostring(specFile)) local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a') if not result:match("Done:") then print(result) diff --git a/yuescript-dev-1.rockspec b/yuescript-dev-1.rockspec index 1d69998..864cf2e 100644 --- a/yuescript-dev-1.rockspec +++ b/yuescript-dev-1.rockspec @@ -2,13 +2,13 @@ rockspec_format = "3.0" package = "Yuescript" version = "dev-1" source = { - url = "git+https://github.com/pigpigyyy/yuescript" + url = "git+https://github.com/IppClub/YueScript" } description = { summary = "Yuescript is a Moonscript dialect.", detailed = [[ 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. ]], - homepage = "https://github.com/pigpigyyy/yuescript", + homepage = "https://github.com/IppClub/YueScript", maintainer = "Li Jin ", labels = {"yuescript","cpp","transpiler","moonscript"}, license = "MIT" @@ -16,7 +16,6 @@ description = { dependencies = { "lua >= 5.1", } - build = { type = "cmake", variables = { -- cgit v1.2.3-55-g6feb