diff options
| -rw-r--r-- | spec/inputs/compile_doc.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/luarocks_upload.yue | 64 | ||||
| -rw-r--r-- | spec/outputs/compile_doc.lua | 2 | ||||
| -rw-r--r-- | spec/outputs/luarocks_upload.lua | 25 | ||||
| -rw-r--r-- | 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) -> | |||
| 35 | "doc/docs/#{locale}doc/language-basics/literals.md" | 35 | "doc/docs/#{locale}doc/language-basics/literals.md" |
| 36 | "doc/docs/#{locale}doc/language-basics/module.md" | 36 | "doc/docs/#{locale}doc/language-basics/module.md" |
| 37 | "doc/docs/#{locale}doc/reference/license-mit.md" | 37 | "doc/docs/#{locale}doc/reference/license-mit.md" |
| 38 | "doc/docs/#{locale}doc/reference/the-yuescript-library.md" | 38 | "doc/docs/#{locale}doc/advanced/the-yuescript-library.md" |
| 39 | ] | 39 | ] |
| 40 | docs = [ ["codes_from_doc_#{locale}.lua", "yue-#{locale}.md", getFiles locale] for locale in *["en", "zh", "pt-br", "de", "id-id"]] | 40 | docs = [ ["codes_from_doc_#{locale}.lua", "yue-#{locale}.md", getFiles locale] for locale in *["en", "zh", "pt-br", "de", "id-id"]] |
| 41 | for [compiledFile, docFile, docFiles] in *docs | 41 | 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 @@ | |||
| 1 | luarocksKey = ... | 1 | luarocksKey = ... |
| 2 | |||
| 2 | local version | 3 | local version |
| 3 | with? io.open "src/yuescript/yue_compiler.cpp" | 4 | with? io.open "src/yuescript/yue_compiler.cpp" |
| 4 | codes = \read "*a" | 5 | codes = \read "*a" |
| @@ -8,17 +9,52 @@ unless version? | |||
| 8 | print "failed to get version!" | 9 | print "failed to get version!" |
| 9 | os.exit 1 | 10 | os.exit 1 |
| 10 | 11 | ||
| 12 | -- ============================== | ||
| 13 | -- 1. Prepare minimal source tree | ||
| 14 | -- ============================== | ||
| 15 | |||
| 16 | local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp" | ||
| 17 | local pkgRoot = "#{tmpBase}/yuescript_pack_#{version}" | ||
| 18 | local srcDir = "#{pkgRoot}/yuescript-#{version}" | ||
| 19 | local tarFile = "#{pkgRoot}/yuescript-#{version}.tar.gz" | ||
| 20 | |||
| 21 | run = (cmd) -> | ||
| 22 | print cmd | ||
| 23 | ok = os.execute cmd | ||
| 24 | unless ok == true or ok == 0 | ||
| 25 | print "Command failed!" | ||
| 26 | os.exit 1 | ||
| 27 | |||
| 28 | -- clean & create | ||
| 29 | run "rm -rf '#{pkgRoot}'" | ||
| 30 | run "mkdir -p '#{srcDir}'" | ||
| 31 | |||
| 32 | -- copy whitelist files | ||
| 33 | run "cp CMakeLists.txt '#{srcDir}/'" | ||
| 34 | run "cp README.md '#{srcDir}/'" | ||
| 35 | run "cp LICENSE '#{srcDir}/'" | ||
| 36 | run "cp -R src '#{srcDir}/'" | ||
| 37 | |||
| 38 | -- create tar.gz | ||
| 39 | run "tar -C '#{pkgRoot}' -czf '#{tarFile}' 'yuescript-#{version}'" | ||
| 40 | |||
| 41 | local sourceUrl = "file://#{tarFile}" | ||
| 42 | |||
| 43 | -- ========================= | ||
| 44 | -- 2. Generate rockspec | ||
| 45 | -- ========================= | ||
| 46 | |||
| 11 | rockspec = "rockspec_format = '3.0' | 47 | rockspec = "rockspec_format = '3.0' |
| 12 | package = 'Yuescript' | 48 | package = 'Yuescript' |
| 13 | version = '#{version}-1' | 49 | version = '#{version}-1' |
| 14 | source = { | 50 | source = { |
| 15 | url = 'git+https://github.com/pigpigyyy/yuescript' | 51 | url = '#{sourceUrl}' |
| 16 | } | 52 | } |
| 17 | description = { | 53 | description = { |
| 18 | summary = 'Yuescript is a Moonscript dialect.', | 54 | summary = 'Yuescript is a Moonscript dialect.', |
| 19 | detailed = [[ | 55 | detailed = [[ |
| 20 | 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. ]], | 56 | 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. ]], |
| 21 | homepage = 'https://github.com/pigpigyyy/yuescript', | 57 | homepage = 'https://github.com/IppClub/YueScript', |
| 22 | maintainer = 'Li Jin <dragon-fly@qq.com>', | 58 | maintainer = 'Li Jin <dragon-fly@qq.com>', |
| 23 | labels = {'yuescript','cpp','transpiler','moonscript'}, | 59 | labels = {'yuescript','cpp','transpiler','moonscript'}, |
| 24 | license = 'MIT' | 60 | license = 'MIT' |
| @@ -29,8 +65,8 @@ dependencies = { | |||
| 29 | build = { | 65 | build = { |
| 30 | type = 'cmake', | 66 | type = 'cmake', |
| 31 | variables = { | 67 | variables = { |
| 32 | LUA='$(LUA)', | 68 | LUA = '$(LUA)', |
| 33 | LUA_INCDIR='$(LUA_INCDIR)', | 69 | LUA_INCDIR = '$(LUA_INCDIR)', |
| 34 | CMAKE_BUILD_TYPE='Release' | 70 | CMAKE_BUILD_TYPE='Release' |
| 35 | }, | 71 | }, |
| 36 | install = { | 72 | install = { |
| @@ -40,14 +76,34 @@ build = { | |||
| 40 | bin = { | 76 | bin = { |
| 41 | 'build.luarocks/yue' | 77 | 'build.luarocks/yue' |
| 42 | } | 78 | } |
| 79 | }, | ||
| 80 | platforms = { | ||
| 81 | windows = { | ||
| 82 | install = { | ||
| 83 | lib = { | ||
| 84 | 'build.luarocks/Release/yue.dll' | ||
| 85 | }, | ||
| 86 | bin = { | ||
| 87 | 'build.luarocks/Release/yue.exe' | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 43 | } | 91 | } |
| 44 | }" | 92 | }" |
| 45 | 93 | ||
| 46 | specFile = "yuescript-#{version}-1.rockspec" | 94 | specFile = "yuescript-#{version}-1.rockspec" |
| 95 | |||
| 47 | with? io.open specFile, "w+" | 96 | with? io.open specFile, "w+" |
| 48 | \write rockspec | 97 | \write rockspec |
| 49 | \close! | 98 | \close! |
| 50 | 99 | ||
| 100 | print "Using source: #{sourceUrl}" | ||
| 101 | print "Uploading rockspec: #{specFile}" | ||
| 102 | |||
| 103 | -- ========================= | ||
| 104 | -- 3. Upload | ||
| 105 | -- ========================= | ||
| 106 | |||
| 51 | result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a' | 107 | result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a' |
| 52 | unless result\match "Done:" | 108 | unless result\match "Done:" |
| 53 | print result | 109 | 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) | |||
| 45 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/literals.md", | 45 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/literals.md", |
| 46 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/module.md", | 46 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/module.md", |
| 47 | "doc/docs/" .. tostring(locale) .. "doc/reference/license-mit.md", | 47 | "doc/docs/" .. tostring(locale) .. "doc/reference/license-mit.md", |
| 48 | "doc/docs/" .. tostring(locale) .. "doc/reference/the-yuescript-library.md" | 48 | "doc/docs/" .. tostring(locale) .. "doc/advanced/the-yuescript-library.md" |
| 49 | } | 49 | } |
| 50 | end | 50 | end |
| 51 | local docs | 51 | 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 | |||
| 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) |
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" | |||
| 2 | package = "Yuescript" | 2 | package = "Yuescript" |
| 3 | version = "dev-1" | 3 | version = "dev-1" |
| 4 | source = { | 4 | source = { |
| 5 | url = "git+https://github.com/pigpigyyy/yuescript" | 5 | url = "git+https://github.com/IppClub/YueScript" |
| 6 | } | 6 | } |
| 7 | description = { | 7 | description = { |
| 8 | summary = "Yuescript is a Moonscript dialect.", | 8 | summary = "Yuescript is a Moonscript dialect.", |
| 9 | detailed = [[ | 9 | detailed = [[ |
| 10 | 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. ]], | 10 | 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. ]], |
| 11 | homepage = "https://github.com/pigpigyyy/yuescript", | 11 | homepage = "https://github.com/IppClub/YueScript", |
| 12 | maintainer = "Li Jin <dragon-fly@qq.com>", | 12 | maintainer = "Li Jin <dragon-fly@qq.com>", |
| 13 | labels = {"yuescript","cpp","transpiler","moonscript"}, | 13 | labels = {"yuescript","cpp","transpiler","moonscript"}, |
| 14 | license = "MIT" | 14 | license = "MIT" |
| @@ -16,7 +16,6 @@ description = { | |||
| 16 | dependencies = { | 16 | dependencies = { |
| 17 | "lua >= 5.1", | 17 | "lua >= 5.1", |
| 18 | } | 18 | } |
| 19 | |||
| 20 | build = { | 19 | build = { |
| 21 | type = "cmake", | 20 | type = "cmake", |
| 22 | variables = { | 21 | variables = { |
