-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlfons.yue
73 lines (68 loc) · 2.24 KB
/
Alfons.yue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
tasks:
always: => load 'fir'
--- @task make Install a local version
--- @option make [v] <version:string> Version to make
make: => sh "rockbuild -m --delete #{@v}" if @v
--- @task release Create and upload a release of Alfons using %{magenta}`rockbuild`%{reset}.
--- @option release [v] <version:string> Version to release
release: => sh "rockbuild -m -t #{@v} u" if @v
--- @task compile Compile all MoonScript and Yuescript
compile: =>
sh "moonc #{file}" for file in wildcard "fir/**.moon"
sh "yue bin"
sh "yue fir"
sh "yue alfons/tasks"
--- @task clean Clean all generated Lua files
clean: =>
show "Cleaning files"
for file in wildcard "**.lua"
fs.remove file
--- @task docs Manage documentation
--- @option docs [serve] Open a preview of the documentation
--- @option docs [build] Builds a static site from the documentation
docs: =>
logo_path = '/fir/fir-logo.png'
if @generate
tasks.fir
generate: true
writer: (_path, content) ->
if _path\match 'docs/index.md'
writefile _path, content
\gsub '> %[!TIP%]\n> ', '!!! tip\n '
\gsub '%]%(#([a-z])(.-)%)', (initial, rest) -> "](##{initial\upper!}#{rest})"
\gsub '<img(.-)>', "![Fir Logo](#{logo_path}){ width=128 height=128 align=left }"
else
writefile _path, content
config:
name: "Fir"
-- general config
format: "markdown"
emit:
symbols_in_code: true
inline_type: true
tabs:
use: "pymdownx"
-- language (moon/yue)
language: {single: "--"}
-- files
input: {
"fir/**.yue"
{ "README.md", verbatim: true }
{ "fir/**.md", verbatim: true }
}
transform: (path) ->
if path\match "yue$"
(path\match "fir/(.+)%.yue") .. ".md"
elseif path\match "README.md"
"index.md"
else
path\match "fir/(.+)"
output: "docs"
ignore: {
"fir/version.yue"
"fir/file.yue"
}
if @serve
sh "mkdocs serve"
if @build
sh "mkdocs build"