diff options
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/compile_doc.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/luarocks_upload.yue | 64 |
2 files changed, 61 insertions, 5 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 |
