aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-11-01 10:15:25 +0800
committerLi Jin <dragon-fly@qq.com>2023-11-01 10:15:25 +0800
commit701f1fbcba10e0700728dd466778defc784f164d (patch)
tree666e472a824e3f9a21eaae710977704750fab664 /spec
parentd092bafc74a851939925ec2d40a8bd364b607d68 (diff)
downloadyuescript-701f1fbcba10e0700728dd466778defc784f164d.tar.gz
yuescript-701f1fbcba10e0700728dd466778defc784f164d.tar.bz2
yuescript-701f1fbcba10e0700728dd466778defc784f164d.zip
add luarocks upload. [skip CI]
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/luarocks_upload.yue55
-rw-r--r--spec/outputs/luarocks_upload.lua28
2 files changed, 83 insertions, 0 deletions
diff --git a/spec/inputs/luarocks_upload.yue b/spec/inputs/luarocks_upload.yue
new file mode 100644
index 0000000..30e8434
--- /dev/null
+++ b/spec/inputs/luarocks_upload.yue
@@ -0,0 +1,55 @@
1luarocksKey = ...
2local version
3with? io.open "src/yuescript/yue_compiler.cpp"
4 codes = \read "*a"
5 \close!
6 version = codes\match "const std::string_view version = \"(.-)\"sv;"
7unless version?
8 print "failed to get version!"
9 os.exit 1
10
11rockspec = "rockspec_format = '3.0'
12package = 'Yuescript'
13version = '#{version}-1'
14source = {
15 url = 'git+https://github.com/pigpigyyy/yuescript'
16}
17description = {
18 summary = 'Yuescript is a Moonscript dialect.',
19 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. ]],
21 homepage = 'https://github.com/pigpigyyy/yuescript',
22 maintainer = 'Li Jin <dragon-fly@qq.com>',
23 labels = {'yuescript','cpp','transpiler','moonscript'},
24 license = 'MIT'
25}
26dependencies = {
27 'lua >= 5.1',
28}
29build = {
30 type = 'cmake',
31 variables = {
32 LUA='$(LUA)',
33 LUA_INCDIR='$(LUA_INCDIR)',
34 CMAKE_BUILD_TYPE='Release'
35 },
36 install = {
37 lib = {
38 'build.luarocks/yue.so'
39 },
40 bin = {
41 'build.luarocks/yue'
42 }
43 }
44}"
45
46specFile = "yuescript-#{version}-1.rockspec"
47with? io.open specFile, "w+"
48 \write rockspec
49 \close!
50
51result = io.popen("luarocks upload --api-key #{luarocksKey} #{specFile}")\read '*a'
52unless result\match "Done:"
53 print result
54 os.exit 1
55
diff --git a/spec/outputs/luarocks_upload.lua b/spec/outputs/luarocks_upload.lua
new file mode 100644
index 0000000..96988d7
--- /dev/null
+++ b/spec/outputs/luarocks_upload.lua
@@ -0,0 +1,28 @@
1local luarocksKey = ...
2local version
3do
4 local _with_0 = io.open("src/yuescript/yue_compiler.cpp")
5 if _with_0 ~= nil then
6 local codes = _with_0:read("*a")
7 _with_0:close()
8 version = codes:match("const std::string_view version = \"(.-)\"sv;")
9 end
10end
11if not (version ~= nil) then
12 print("failed to get version!")
13 os.exit(1)
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}"
16local specFile = "yuescript-" .. tostring(version) .. "-1.rockspec"
17do
18 local _with_0 = io.open(specFile, "w+")
19 if _with_0 ~= nil then
20 _with_0:write(rockspec)
21 _with_0:close()
22 end
23end
24local result = io.popen("luarocks upload --api-key " .. tostring(luarocksKey) .. " " .. tostring(specFile)):read('*a')
25if not result:match("Done:") then
26 print(result)
27 return os.exit(1)
28end