aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/compile_doc.yue2
-rw-r--r--spec/inputs/luarocks_upload.yue64
-rw-r--r--spec/outputs/compile_doc.lua2
-rw-r--r--spec/outputs/luarocks_upload.lua25
4 files changed, 86 insertions, 7 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 ]
40docs = [ ["codes_from_doc_#{locale}.lua", "yue-#{locale}.md", getFiles locale] for locale in *["en", "zh", "pt-br", "de", "id-id"]] 40docs = [ ["codes_from_doc_#{locale}.lua", "yue-#{locale}.md", getFiles locale] for locale in *["en", "zh", "pt-br", "de", "id-id"]]
41for [compiledFile, docFile, docFiles] in *docs 41for [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 @@
1luarocksKey = ... 1luarocksKey = ...
2
2local version 3local version
3with? io.open "src/yuescript/yue_compiler.cpp" 4with? 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
16local tmpBase = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR") or "/tmp"
17local pkgRoot = "#{tmpBase}/yuescript_pack_#{version}"
18local srcDir = "#{pkgRoot}/yuescript-#{version}"
19local tarFile = "#{pkgRoot}/yuescript-#{version}.tar.gz"
20
21run = (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
29run "rm -rf '#{pkgRoot}'"
30run "mkdir -p '#{srcDir}'"
31
32-- copy whitelist files
33run "cp CMakeLists.txt '#{srcDir}/'"
34run "cp README.md '#{srcDir}/'"
35run "cp LICENSE '#{srcDir}/'"
36run "cp -R src '#{srcDir}/'"
37
38-- create tar.gz
39run "tar -C '#{pkgRoot}' -czf '#{tarFile}' 'yuescript-#{version}'"
40
41local sourceUrl = "file://#{tarFile}"
42
43-- =========================
44-- 2. Generate rockspec
45-- =========================
46
11rockspec = "rockspec_format = '3.0' 47rockspec = "rockspec_format = '3.0'
12package = 'Yuescript' 48package = 'Yuescript'
13version = '#{version}-1' 49version = '#{version}-1'
14source = { 50source = {
15 url = 'git+https://github.com/pigpigyyy/yuescript' 51 url = '#{sourceUrl}'
16} 52}
17description = { 53description = {
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 = {
29build = { 65build = {
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
46specFile = "yuescript-#{version}-1.rockspec" 94specFile = "yuescript-#{version}-1.rockspec"
95
47with? io.open specFile, "w+" 96with? io.open specFile, "w+"
48 \write rockspec 97 \write rockspec
49 \close! 98 \close!
50 99
100print "Using source: #{sourceUrl}"
101print "Uploading rockspec: #{specFile}"
102
103-- =========================
104-- 3. Upload
105-- =========================
106
51result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a' 107result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a'
52unless result\match "Done:" 108unless 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 }
50end 50end
51local docs 51local 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)
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)