No longer importing sys module.
h3rald h3rald@h3rald.com
Sun, 29 Sep 2024 10:38:08 +0200
13 files changed,
55 insertions(+),
55 deletions(-)
M
next-release.md
→
next-release.md
@@ -29,18 +29,19 @@ - **time** module: renamed **tformat** to **time.format**
- **time** module: renamed **timeinfo** to **time.info** - **time** module: renamed **timestamp** to **time.stamp** - The **dict** module is no longer imported. -- **dict** moduule: renamed **dhas?** to **dict.has?** -- **dict** moduule: renamed **dget** to **dict.get** -- **dict** moduule: renamed **dget-raw** to **dict.get-raw** -- **dict** moduule: renamed **dset** to **dict.set** -- **dict** moduule: renamed **dset-sym** to **dict.set-sym** -- **dict** moduule: renamed **ddel** to **dict.del** -- **dict** moduule: renamed **dkeys** to **dict.keys** -- **dict** moduule: renamed **dvalues** to **dict.values** -- **dict** moduule: renamed **dpairs** to **dict.pairs** -- **dict** moduule: renamed **ddup** to **dict.dup** -- **dict** moduule: renamed **dpick** to **dict.pick** -- **dict** moduule: renamed **dtype** to **dict.type** +- **dict** module: renamed **dhas?** to **dict.has?** +- **dict** module: renamed **dget** to **dict.get** +- **dict** module: renamed **dget-raw** to **dict.get-raw** +- **dict** module: renamed **dset** to **dict.set** +- **dict** module: renamed **dset-sym** to **dict.set-sym** +- **dict** module: renamed **ddel** to **dict.del** +- **dict** module: renamed **dkeys** to **dict.keys** +- **dict** module: renamed **dvalues** to **dict.values** +- **dict** module: renamed **dpairs** to **dict.pairs** +- **dict** module: renamed **ddup** to **dict.dup** +- **dict** module: renamed **dpick** to **dict.pick** +- **dict** module: renamed **dtype** to **dict.type** +- The **sys** module is no longer imported.
M
prelude.min
→
prelude.min
@@ -1,5 +1,4 @@
; Imports -'sys import 'dstore import 'crypto import 'math import
M
tasks/_helpers.min
→
tasks/_helpers.min
@@ -1,1 +1,1 @@
- "min.yml" fs.read from-yaml :config ".env.yml" fs.read from-yaml :env ( symbol required ('sym :prog ==>) ( (prog which "" ==) ("$# is not available" (prog) =% io.error 1 exit) when ) ) ::+ "min.yml" fs.read from-yaml :config ".env.yml" fs.read from-yaml :env ( symbol required ('sym :prog ==>) ( (prog sys.which "" ==) ("$# is not available" (prog) =% io.error 1 exit) when ) ) ::
M
tasks/build.min
→
tasks/build.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env minsystemsystemsystem "_helpers" require :helpers 'helpers import ( symbol cz ('sym :stage 'sym :variant 'sym :target-os ==>) ( true :pack-result (stage "^(release-nopack|dev)$" match?) (false @pack-result) when "-d:release" :d-stage (stage "dev" ==) ("-d:dev" @d-stage) when " " :d-variant "min" :o-variant (variant length 0 >) ( "-d:$# " (variant) =% @d-variant "$#min" (variant) =% @o-variant ) when "nim" required "Building $# - $# (x64)" (o-variant target-os) =% io.notice! "" :musl "musl-gcc" which :musl-gcc (musl-gcc length 0 >) ("--gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc" @musl) when "nim c $# -d:ssl -d:useOpenSsl3 $# --opt:size --cpu:amd64 --os:$# $#-o:$# min" (d-stage musl target-os d-variant o-variant) =% puts system stack.pop (pack-result) ( {} target-os "os" dict.set config "version" dict.get "version" dict.set o-variant "exe" dict.set pack ) when ) ) :: ;; Builds and packs a min executable. #|| Tasks ||# ( symbol guide (==>) ( "hastyscribe" required "Building - guide" io.notice! "hastyscribe Min_DeveloperGuide.md --field/version=$#" (version) =% system "cp Min_DeveloperGuide.htm site/output/guide.dev.html" system ) ) :: ;; Builds the developer guide. ( symbol site (==>) ( "hastysite" required "Building - site" io.notice! "cd site && hastysite build && cd .." system ) ) :: ;; Builds the min site. ( symbol pack (dict :vdata ==>) ( vdata "exe" dict.get :exe (vdata "os" dict.get "windows" ==) ("$#.exe" (exe) =% @exe) when "$exe:_v$version:_$os:_x64.zip" :fn fn vdata dict.pairs % ":" "" replace @fn "Compressing: $#" (fn) =% io.notice! (exe) => fn zip ) ) :: ;; Compresses a min executable. ( symbol vim (==>) ( config "version" dict.get :min-version "tasks/data/min.vim" fs.read :template time.stamp "dd MMM YYYY" time.format :date min-symbols ("||" !=) filter " " join :symbols "min.vim" :out-file "Building - min.vim" io.notice! template ("date" date "version" min-version "symbols" symbols) =% out-file fs.write ) ) :: ;; Generates the min.vim file. ( symbol docs (==>) ( guide site ) ) :: ;; Generate the min development guide and site. ( symbol dev (==>) ("dev" "" os cz) ) :: ;; Builds min (dev version) on the current OS. ( symbol default (==>) ("release-nopack" "" os cz) ) :: ;; Builds min on the current OS. ( symbol linux (==>) ("" "" "linux" cz) ) :: ;; Builds min for Linux. ( symbol macosx (==>) ("" "" "macosx" cz) ) :: ;; Builds min for macOS. ( symbol windows (==>) ("" "" "windows" cz) ) :: ;; Builds min for Windows. +#!/usr/bin/env minsystemsystemsystem "_helpers" require :helpers 'helpers import ( symbol cz ('sym :stage 'sym :variant 'sym :target-os ==>) ( true :pack-result (stage "^(release-nopack|dev)$" match?) (false @pack-result) when "-d:release" :d-stage (stage "dev" ==) ("-d:dev" @d-stage) when " " :d-variant "min" :o-variant (variant length 0 >) ( "-d:$# " (variant) =% @d-variant "$#min" (variant) =% @o-variant ) when "nim" required "Building $# - $# (x64)" (o-variant target-os) =% io.notice! "" :musl "musl-gcc" sys.which :musl-gcc (musl-gcc length 0 >) ("--gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc" @musl) when "nim c $# -d:ssl -d:useOpenSsl3 $# --opt:size --cpu:amd64 --os:$# $#-o:$# min" (d-stage musl target-os d-variant o-variant) =% puts sys.system stack.pop (pack-result) ( {} target-os "os" dict.set config "version" dict.get "version" dict.set o-variant "exe" dict.set pack ) when ) ) :: ;; Builds and packs a min executable. #|| Tasks ||# ( symbol guide (==>) ( "hastyscribe" required "Building - guide" io.notice! "hastyscribe Min_DeveloperGuide.md --field/version=$#" (version) =% sys.system "cp Min_DeveloperGuide.htm site/output/guide.dev.html" sys.system ) ) :: ;; Builds the developer guide. ( symbol site (==>) ( "hastysite" required "Building - site" io.notice! "cd site && hastysite build && cd .." sys.system ) ) :: ;; Builds the min site. ( symbol pack (dict :vdata ==>) ( vdata "exe" dict.get :exe (vdata "os" dict.get "windows" ==) ("$#.exe" (exe) =% @exe) when "$exe:_v$version:_$os:_x64.zip" :fn fn vdata dict.pairs % ":" "" replace @fn "Compressing: $#" (fn) =% io.notice! (exe) => fn sys.zip ) ) :: ;; Compresses a min executable. ( symbol vim (==>) ( config "version" dict.get :min-version "tasks/data/min.vim" fs.read :template time.stamp "dd MMM YYYY" time.format :date min-symbols ("||" !=) filter " " join :symbols "min.vim" :out-file "Building - min.vim" io.notice! template ("date" date "version" min-version "symbols" symbols) =% out-file fs.write ) ) :: ;; Generates the min.vim file. ( symbol docs (==>) ( guide site ) ) :: ;; Generate the min development guide and site. ( symbol dev (==>) ("dev" "" sys.os cz) ) :: ;; Builds min (dev version) on the current OS. ( symbol default (==>) ("release-nopack" "" sys.os cz) ) :: ;; Builds min on the current OS. ( symbol linux (==>) ("" "" "linux" cz) ) :: ;; Builds min for Linux. ( symbol macosx (==>) ("" "" "macosx" cz) ) :: ;; Builds min for macOS. ( symbol windows (==>) ("" "" "windows" cz) ) :: ;; Builds min for Windows.
M
tasks/clean.min
→
tasks/clean.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env min #| Tasks |# ( symbol default (==>) ( "Cleaning up build files" io.notice! pwd ls ("(/(mini|lite)?min|\\.(htm|zip|exe))$" match?) filter :files files 'rm foreach "Done." io.notice! ) ) :: ;; Deletes min build files +#!/usr/bin/env min #| Tasks |# ( symbol default (==>) ( "Cleaning up build files" io.notice! sys.pwd sys.ls ("(/(mini|lite)?min|\\.(htm|zip|exe))$" match?) filter :files files 'rm foreach "Done." io.notice! ) ) :: ;; Deletes min build files
M
tasks/github.min
→
tasks/github.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env min "_helpers" require :helpers 'helpers import "next-release.md" fs.read escape :release-body "tasks/data/draft-release.json" fs.read :draft-release-template config "version" dict.get :min-version env "github-token" dict.get :token draft-release-template ("version" min-version "body" release-body) =% :draft-release-body {} "application/vnd.github.v3+json" "Accept" dict.set "token $#" (token) =% "Authorization" dict.set :headers ( symbol handle-errors (dict :response ==>) ( response to-json "response.json" fs.write response "status" dict.get :status (status 300 >) ( response "body" dict.get from-json :body body "message" dict.get :message status string @status "Error $#: $#" (status message) =% io.error status int exit ) when ) ) :: ;; Handles HTTP errors. ( symbol gh-req (dict :data ==> dict|quot :result) ( data "endpoint" dict.get :endpoint "api" :subdomain (data 'subdomain dict.has?) (data "subdomain" dict.get @subdomain) when "https://$#.github.com/repos/h3rald/min$#" (subdomain endpoint) =% :url {} url "url" dict.set data "method" dict.get "method" dict.set (data 'headers dict.has?) (data "headers" dict.get "headers" dict.set) (headers "headers" dict.set) if (data 'body dict.has?) (data "body" dict.get "body" dict.set) when request :response response "status" dict.get :status response "body" dict.get :body response handle-errors (body length 0 >) (body from-json) ({}) if @result ) ) :: ;; Execute a request using the Github API. ( symbol get-assets (dict :data ==> quot :result) ( data "id" dict.get :id {} "/releases/$#/assets" (id) =% "endpoint" dict.set "GET" "method" dict.set gh-req @result ) ) :: ;; Retrieve the assets from an existing Github release. ( symbol delete-assets (dict :config ==>) ( config get-assets :assets config "id" dict.get :id assets ("id" dict.get) map :assets-ids assets-ids ( :asset {} "/releases/assets/$#" (asset) =% "endpoint" dict.set "DELETE" "method" dict.set gh-req stack.pop ) foreach ) ) :: ;; Delete all assets from an existing Github release. #|| Tasks ||# ( symbol draft (==>) ( {} "/releases" "endpoint" dict.set "POST" "method" dict.set draft-release-body "body" dict.set gh-req "id" dict.get string :id ;; Save Release ID to min.yml config id "id" dict.set to-yaml "min.yml" fs.write "Draft release v$# ($#) created successfully" (min-version id) =% io.notice! ) ) :: ;; Creates a new draft release on Github. ( symbol update (==>) ( config "id" dict.get :id {} "/releases/$#" (id) =% "endpoint" dict.set "PATCH" "method" dict.set draft-release-body "body" dict.set gh-req "id" dict.get string :id "Draft release v$# ($#) updated successfully" (min-version id) =% io.notice! ) ) :: ;; Updates the text of the current draft Github release. ( symbol assets (==>) ( config get-assets =assets assets size :total "are" :verb (total 1 ==) ("is" @verb) when "There $# $# assets in release v$#" (verb total min-version) =% io.notice! assets ("name" dict.get () stack.cons "- $#" stack.swap % io.notice!) foreach ) ) :: ;; Retrieve a list of all the assets of the current draft Github release. ( symbol upload (==>) ( config "id" dict.get :id config delete-assets pwd ls ("\\.zip$" match?) filter ( fs.filename :file "Uploading: $#" (file) =% io.notice! file fs.read :body headers "application/zip" "Content-Type" dict.set :asset-headers {} "/releases/$#/assets?name=$#" (id file) =% "endpoint" dict.set asset-headers "headers" dict.set "uploads" "subdomain" dict.set "POST" "method" dict.set body "body" dict.set gh-req stack.pop ) foreach ) ) :: ;; Uploads all assets to the current draft Github release, deleting any existing asset. +#!/usr/bin/env min "_helpers" require :helpers 'helpers import "next-release.md" fs.read escape :release-body "tasks/data/draft-release.json" fs.read :draft-release-template config "version" dict.get :min-version env "github-token" dict.get :token draft-release-template ("version" min-version "body" release-body) =% :draft-release-body {} "application/vnd.github.v3+json" "Accept" dict.set "token $#" (token) =% "Authorization" dict.set :headers ( symbol handle-errors (dict :response ==>) ( response to-json "response.json" fs.write response "status" dict.get :status (status 300 >) ( response "body" dict.get from-json :body body "message" dict.get :message status string @status "Error $#: $#" (status message) =% io.error status int exit ) when ) ) :: ;; Handles HTTP errors. ( symbol gh-req (dict :data ==> dict|quot :result) ( data "endpoint" dict.get :endpoint "api" :subdomain (data 'subdomain dict.has?) (data "subdomain" dict.get @subdomain) when "https://$#.github.com/repos/h3rald/min$#" (subdomain endpoint) =% :url {} url "url" dict.set data "method" dict.get "method" dict.set (data 'headers dict.has?) (data "headers" dict.get "headers" dict.set) (headers "headers" dict.set) if (data 'body dict.has?) (data "body" dict.get "body" dict.set) when request :response response "status" dict.get :status response "body" dict.get :body response handle-errors (body length 0 >) (body from-json) ({}) if @result ) ) :: ;; Execute a request using the Github API. ( symbol get-assets (dict :data ==> quot :result) ( data "id" dict.get :id {} "/releases/$#/assets" (id) =% "endpoint" dict.set "GET" "method" dict.set gh-req @result ) ) :: ;; Retrieve the assets from an existing Github release. ( symbol delete-assets (dict :config ==>) ( config get-assets :assets config "id" dict.get :id assets ("id" dict.get) map :assets-ids assets-ids ( :asset {} "/releases/assets/$#" (asset) =% "endpoint" dict.set "DELETE" "method" dict.set gh-req stack.pop ) foreach ) ) :: ;; Delete all assets from an existing Github release. #|| Tasks ||# ( symbol draft (==>) ( {} "/releases" "endpoint" dict.set "POST" "method" dict.set draft-release-body "body" dict.set gh-req "id" dict.get string :id ;; Save Release ID to min.yml config id "id" dict.set to-yaml "min.yml" fs.write "Draft release v$# ($#) created successfully" (min-version id) =% io.notice! ) ) :: ;; Creates a new draft release on Github. ( symbol update (==>) ( config "id" dict.get :id {} "/releases/$#" (id) =% "endpoint" dict.set "PATCH" "method" dict.set draft-release-body "body" dict.set gh-req "id" dict.get string :id "Draft release v$# ($#) updated successfully" (min-version id) =% io.notice! ) ) :: ;; Updates the text of the current draft Github release. ( symbol assets (==>) ( config get-assets =assets assets size :total "are" :verb (total 1 ==) ("is" @verb) when "There $# $# assets in release v$#" (verb total min-version) =% io.notice! assets ("name" dict.get () stack.cons "- $#" stack.swap % io.notice!) foreach ) ) :: ;; Retrieve a list of all the assets of the current draft Github release. ( symbol upload (==>) ( config "id" dict.get :id config delete-assets sys.pwd sys.ls ("\\.zip$" match?) filter ( fs.filename :file "Uploading: $#" (file) =% io.notice! file fs.read :body headers "application/zip" "Content-Type" dict.set :asset-headers {} "/releases/$#/assets?name=$#" (id file) =% "endpoint" dict.set asset-headers "headers" dict.set "uploads" "subdomain" dict.set "POST" "method" dict.set body "body" dict.set gh-req stack.pop ) foreach ) ) :: ;; Uploads all assets to the current draft Github release, deleting any existing asset.
M
tasks/h3rald.min
→
tasks/h3rald.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env minsystemsystem "_helpers" require :helpers 'helpers import config "version" dict.get :min-version "Min_DeveloperGuide.htm" :guide-file "../h3rald/assets/min/" guide-file suffix :h3rald-guide "../h3rald/contents/min.md" :h3rald-min-md "version:\\s+\\d+\\.\\d+\\.\\d+" :min-v-reg "version: $#" (min-version) =% :min-v-rep ( symbol update (==>) ( "Updating min Developer Guide and project on H3RALD.com..." io.notice! guide-file h3rald-guide cp h3rald-min-md fs.read min-v-reg min-v-rep replace :updated-contents updated-contents h3rald-min-md fs.write "Done." io.notice! ) ) :: ;; Updates the min Developer Guide and project page on H3RALD.com ( symbol build (==>) ( "git" required "hastysite" required "Pulling content and rebuilding H3RALD.com web site..." io.notice! ;; Assuming min and h3rald are siblings parent-dir cd "h3rald" cd "git pull" system "hastysite build" system parent-dir cd "min" cd ) ) :: ;; Builds H3RALD.com web site +#!/usr/bin/env minsystemsystem "_helpers" require :helpers 'helpers import config "version" dict.get :min-version "Min_DeveloperGuide.htm" :guide-file "../h3rald/assets/min/" guide-file suffix :h3rald-guide "../h3rald/contents/min.md" :h3rald-min-md "version:\\s+\\d+\\.\\d+\\.\\d+" :min-v-reg "version: $#" (min-version) =% :min-v-rep ( symbol update (==>) ( "Updating min Developer Guide and project on H3RALD.com..." io.notice! guide-file h3rald-guide sys.cp h3rald-min-md fs.read min-v-reg min-v-rep replace :updated-contents updated-contents h3rald-min-md fs.write "Done." io.notice! ) ) :: ;; Updates the min Developer Guide and project page on H3RALD.com ( symbol build (==>) ( "git" required "hastysite" required "Pulling content and rebuilding H3RALD.com web site..." io.notice! ;; Assuming min and h3rald are siblings sys.parent-dir sys.cd "h3rald" sys.cd "git pull" sys.system "hastysite build" sys.system sys.parent-dir sys.cd "min" sys.cd ) ) :: ;; Builds H3RALD.com web site
M
tasks/help.min
→
tasks/help.min
@@ -1,1 +1,1 @@
-"tasks/data/doc-snippets.json" fs.read from-json :snippets "site/contents" ls ("reference-" match?) filter :src-files "(?sm)\\{#op\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|(.+?)#\\}" :op-regex "(?sm)\\{#sig\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :sig-regex "(?sm)\\{#alias\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :alias-regex "(?sm)\\{\\{([^}]+)\\}\\}" :snippet-regex "(?sm)\\>( \\>)*" :block-regex "(?sm)%([^%]+)%" :title-regex "(?sm)\\{@[^@]+@\\}" :incl-regex "(?sm)`([^`]+)`" :code-regex ( symbol fix-name (str :s ==> str :result) ( s "!" (stack.pop "!") replace-apply """ (stack.pop "\"") replace-apply "|" (stack.pop "|") replace-apply "\\[" (stack.pop "") replace-apply "\\]" (stack.pop "") replace-apply "\\(class:kwd\\)" (stack.pop "") replace-apply ">" (stack.pop ">") replace-apply "<" (stack.pop "<") replace-apply "'" (stack.pop "'") replace-apply "*" (stack.pop "*") replace-apply @result ) ) :: ;; Fixes names with special characters ( symbol process-block-markup (str :s ==> str :result) ( s block-regex (stack.pop "") replace-apply title-regex (stack.pop "") replace-apply incl-regex (stack.pop "") replace-apply code-regex (1 get) replace-apply @result ) ) :: ;; Simplify block-level markup ( symbol process-snippets (str :s ==> str :result) ( s snippet-regex ( 1 get :id snippets id dict.get ) replace-apply @result ) ) :: ;; Resolves documentation snippets. ( symbol process (str :s ==> str :result) ( s process-snippets process-block-markup strip @result ) ) :: ;; Processes documentation snippets and markup. ( symbol process-op (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get process fix-name :input matches 3 get process fix-name :output "$# ==> $#" (input output) =% "signature" dict.set matches 4 get process "description" dict.set "symbol" "kind" dict.set @data ) ) :: ;; Processes operator reference documentation. ( symbol process-alias (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get :ref "See $#" (ref) =% "description" dict.set "symbol" "kind" dict.set @data ) ) :: ;; Processes alias reference documentation. ( symbol process-sig (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get :ref "See $#" (ref) =% "description" dict.set "sigil" "kind" dict.set @data ) ) :: ;; Processes sigil reference documentation. ( symbol default (==>) ( {} :ref-dict {} :op-dict {} :sig-dict src-files ( :file file "reference-([a-z]+)\\.md" search 1 get :mod-id "Processing: $#" (mod-id) =% io.notice! file fs.read :contents contents op-regex search-all ( process-op :op op "name" dict.get :op-name op mod-id 'module dict.set @op op-dict op op-name dict.set @op-dict ) foreach contents alias-regex search-all ( process-alias :alias alias "name" dict.get :alias-name alias mod-id 'module dict.set @alias op-dict alias alias-name dict.set @op-dict ) foreach contents sig-regex search-all ( process-sig :sig sig "name" dict.get :sig-name sig mod-id 'module dict.set @sig sig-dict sig sig-name dict.set @sig-dict ) foreach ref-dict op-dict "symbols" dict.set sig-dict "sigils" dict.set @ref-dict ) foreach "Writing help.json" io.notice! ref-dict to-json "help.json" fs.write ) ) :: ;; Builds the reference help JSON sources. +"tasks/data/doc-snippets.json" fs.read from-json :snippets "site/contents" sys.ls ("reference-" match?) filter :src-files "(?sm)\\{#op\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|(.+?)#\\}" :op-regex "(?sm)\\{#sig\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :sig-regex "(?sm)\\{#alias\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :alias-regex "(?sm)\\{\\{([^}]+)\\}\\}" :snippet-regex "(?sm)\\>( \\>)*" :block-regex "(?sm)%([^%]+)%" :title-regex "(?sm)\\{@[^@]+@\\}" :incl-regex "(?sm)`([^`]+)`" :code-regex ( symbol fix-name (str :s ==> str :result) ( s "!" (stack.pop "!") replace-apply """ (stack.pop "\"") replace-apply "|" (stack.pop "|") replace-apply "\\[" (stack.pop "") replace-apply "\\]" (stack.pop "") replace-apply "\\(class:kwd\\)" (stack.pop "") replace-apply ">" (stack.pop ">") replace-apply "<" (stack.pop "<") replace-apply "'" (stack.pop "'") replace-apply "*" (stack.pop "*") replace-apply @result ) ) :: ;; Fixes names with special characters ( symbol process-block-markup (str :s ==> str :result) ( s block-regex (stack.pop "") replace-apply title-regex (stack.pop "") replace-apply incl-regex (stack.pop "") replace-apply code-regex (1 get) replace-apply @result ) ) :: ;; Simplify block-level markup ( symbol process-snippets (str :s ==> str :result) ( s snippet-regex ( 1 get :id snippets id dict.get ) replace-apply @result ) ) :: ;; Resolves documentation snippets. ( symbol process (str :s ==> str :result) ( s process-snippets process-block-markup strip @result ) ) :: ;; Processes documentation snippets and markup. ( symbol process-op (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get process fix-name :input matches 3 get process fix-name :output "$# ==> $#" (input output) =% "signature" dict.set matches 4 get process "description" dict.set "symbol" "kind" dict.set @data ) ) :: ;; Processes operator reference documentation. ( symbol process-alias (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get :ref "See $#" (ref) =% "description" dict.set "symbol" "kind" dict.set @data ) ) :: ;; Processes alias reference documentation. ( symbol process-sig (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dict.set matches 2 get :ref "See $#" (ref) =% "description" dict.set "sigil" "kind" dict.set @data ) ) :: ;; Processes sigil reference documentation. ( symbol default (==>) ( {} :ref-dict {} :op-dict {} :sig-dict src-files ( :file file "reference-([a-z]+)\\.md" search 1 get :mod-id "Processing: $#" (mod-id) =% io.notice! file fs.read :contents contents op-regex search-all ( process-op :op op "name" dict.get :op-name op mod-id 'module dict.set @op op-dict op op-name dict.set @op-dict ) foreach contents alias-regex search-all ( process-alias :alias alias "name" dict.get :alias-name alias mod-id 'module dict.set @alias op-dict alias alias-name dict.set @op-dict ) foreach contents sig-regex search-all ( process-sig :sig sig "name" dict.get :sig-name sig mod-id 'module dict.set @sig sig-dict sig sig-name dict.set @sig-dict ) foreach ref-dict op-dict "symbols" dict.set sig-dict "sigils" dict.set @ref-dict ) foreach "Writing help.json" io.notice! ref-dict to-json "help.json" fs.write ) ) :: ;; Builds the reference help JSON sources.
M
tests/dstore.min
→
tests/dstore.min
@@ -31,7 +31,7 @@ ds "tests/aaa" dsdelete
"tests" ("id" dict.get "aaa" ==) dsquery size 0 == ) test.assert - "dstore.json" rm + "dstore.json" sys.rm test.report stack.clear
M
tests/fs.min
→
tests/fs.min
@@ -26,13 +26,13 @@ ("/home/h3rald" fs.windows-path "\\home\\h3rald" ==) test.assert
("/home/h3rald" fs.absolute-path?) test.assert - ("tests/sys.min" fs.expand-filename fs.unix-path pwd "/tests/sys.min" suffix fs.unix-path ==) test.assert + ("tests/sys.min" fs.expand-filename fs.unix-path sys.pwd "/tests/sys.min" suffix fs.unix-path ==) test.assert ("./../tests" fs.normalized-path fs.unix-path "../tests" ==) test.assert - ((pwd "tests/global.min") => fs.join-path pwd fs.relative-path fs.unix-path "tests/global.min" ==) test.assert + ((sys.pwd "tests/global.min") => fs.join-path sys.pwd fs.relative-path fs.unix-path "tests/global.min" ==) test.assert - ("tests/global.min" fs.absolute-path fs.unix-path (pwd "tests/global.min") => fs.join-path fs.unix-path ==) test.assert + ("tests/global.min" fs.absolute-path fs.unix-path (sys.pwd "tests/global.min") => fs.join-path fs.unix-path ==) test.assert ("./test" fs.absolute-path? not) test.assert@@ -46,4 +46,4 @@ "test.txt" fs.read "TEST - TEST" ==) test.assert
test.report stack.clear - "test.txt" rm + "test.txt" sys.rm
M
tests/global.min
→
tests/global.min
@@ -40,10 +40,10 @@
("3 4 +" eval 7 ==) test.assert ("2 2 +" "tests/testload.min" fs.write 'testload load 4 ==) test.assert - "tests/testload.min" rm + "tests/testload.min" sys.rm ("2 :two 3 :three" "tests/testrequire.min" fs.write 'testrequire require :tm tm.two tm.three + 5 ==) test.assert - "tests/testrequire.min" rm + "tests/testrequire.min" sys.rm (2 quote (2) ==) test.assert@@ -73,7 +73,7 @@ ('error dict.get)
("finally") ) try stack.get ("MinEmptyStackError" "finally") ==) test.assert - ("aaaa" :cd cd "aaaa" ==) test.assert ;;It is possible to shadow sealed symbols in child scopes + ('sys.cd ^cd "aaaa" :cd cd "aaaa" ==) test.assert ;;It is possible to shadow sealed symbols in child scopes (((2 :a1 'a1 seal-symbol 3 :a1) ("failed")) try "failed" ==) test.assert@@ -266,7 +266,7 @@ ;; (:n ((n integer?) (n 0 >)) &&) 'natural typeclass
( typeclass natural (int :n ==> bool :out) - (((n integer?) (n 0 >)) "&" run @out) + (((n integer?) (n 0 >)) "&" sys.run @out) ) :: ("typeclass:natural" defined-symbol?) test.assert (@@ -688,7 +688,7 @@ ("test" 4 indent " test" ==) test.assert
((1 3 "test") ", " join "1, 3, test" ==) test.assert - ("PWD: $pwd" ("pwd" pwd) =% ("PWD: " pwd) => "" join ==) test.assert + ("PWD: $pwd" ("pwd" sys.pwd) =% ("PWD: " sys.pwd) => "" join ==) test.assert ("1.2.3" from-semver {1 :major 2 :minor 3 :patch} ==) test.assert
M
tests/http.min
→
tests/http.min
@@ -9,7 +9,7 @@
("$1/get" (url) => % get-content from-json "headers" dict.get "user-agent" dict.get "min http-module/$1" (version) => % ==) test.assert ("$1/get?test=Hello!" (url) => % "tests/test1.json" :file file download file fs.read from-json "args" dict.get "test" dict.get "Hello!" ==) test.assert - "tests/test1.json" rm + "tests/test1.json" sys.rm ( {} (
M
tests/sys.min
→
tests/sys.min
@@ -3,68 +3,68 @@ ;;;
"sys" test.describe - ("dir1" mkdir "dir1" fs.dir?) test.assert + ("dir1" sys.mkdir "dir1" fs.dir?) test.assert - ("dir1" "dir2" mv "dir2" fs.dir?) test.assert + ("dir1" "dir2" sys.mv "dir2" fs.dir?) test.assert ("dir1" fs.dir? false ==) test.assert - ("dir2" "dir1" cp "dir1" fs.dir?) test.assert + ("dir2" "dir1" sys.cp "dir1" fs.dir?) test.assert ("..." "dir1/test.txt" fs.write "dir1/test.txt" fs.file?) test.assert - ("dir1/test.txt" "dir2" mv "dir2/test.txt" fs.file?) test.assert + ("dir1/test.txt" "dir2" sys.mv "dir2/test.txt" fs.file?) test.assert ("dir1/test.txt" fs.file? false ==) test.assert - ("dir2/test.txt" "dir1" cp "dir1/test.txt" fs.file?) test.assert + ("dir2/test.txt" "dir1" sys.cp "dir1/test.txt" fs.file?) test.assert - ('dir1 ls 'fs.filename map ("test.txt") ==) test.assert + ('dir1 sys.ls 'fs.filename map ("test.txt") ==) test.assert - ('dir2 ls 'fs.dirname map ("dir2") ==) test.assert + ('dir2 sys.ls 'fs.dirname map ("dir2") ==) test.assert - ('dir1 rmdir 'dir2 rmdir 'dir1 fs.dir? 'dir2 fs.dir? or false ==) test.assert + ('dir1 sys.rmdir 'dir2 sys.rmdir 'dir1 fs.dir? 'dir2 fs.dir? or false ==) test.assert - ("systest" mkdir pwd ls (pwd "systest") => "/" join in?) test.assert + ("systest" sys.mkdir sys.pwd sys.ls (sys.pwd "systest") => "/" join in?) test.assert - ("systest" cd pwd "systest" match?) test.assert - parent-dir cd + ("systest" sys.cd sys.pwd "systest" match?) test.assert + sys.parent-dir sys.cd - ("./min -v" run 'output dict.get "\\." match?) test.assert + ("./min -v" sys.run 'output dict.get "\\." match?) test.assert - ("PATH" env?) test.assert + ("PATH" sys.env?) test.assert ($PATH length 0 >) test.assert ("TEST" "AAA" put-env $AAA "TEST" ==) test.assert - (os length 0 >) test.assert + (sys.os length 0 >) test.assert - (cpu length 0 >) test.assert + (sys.cpu length 0 >) test.assert ("TEST" "test.txt" fs.write "test.txt" fs.file?) test.assert - ("test.txt" "test2.txt" cp "test2.txt" fs.file?) test.assert + ("test.txt" "test2.txt" sys.cp "test2.txt" fs.file?) test.assert - ("test.txt" "test1.txt" mv "test1.txt" fs.file?) test.assert + ("test.txt" "test1.txt" sys.mv "test1.txt" fs.file?) test.assert - ("test2.txt" rm "test1.txt" rm pwd ls (pwd "test1.txt") => "/" join in? :t1 pwd ls "test2" in? t1 and false ==) test.assert + ("test2.txt" sys.rm "test1.txt" sys.rm sys.pwd sys.ls (sys.pwd "test1.txt") => "/" join in? :t1 sys.pwd sys.ls "test2" in? t1 and false ==) test.assert - ("systest" cd + ("systest" sys.cd "TEST" "test.txt" fs.write "TEST1" "test1.txt" fs.write "TEST2" "test2.txt" fs.write "TEST3" "test3.txt" fs.write - pwd ls "test.zip" zip pwd ls (pwd "test.zip") => "/" join in?) test.assert + sys.pwd sys.ls "test.zip" sys.zip sys.pwd sys.ls (sys.pwd "test.zip") => "/" join in?) test.assert - ("test.zip" "extracted" unzip "extracted" ls "extracted/test1.txt" in?) test.assert + ("test.zip" "extracted" sys.unzip "extracted" sys.ls "extracted/test1.txt" in?) test.assert - parent-dir cd + sys.parent-dir sys.cd - ("systest" rmdir pwd ls (pwd "systest") => "/" join in? false ==) test.assert + ("systest" sys.rmdir sys.pwd sys.ls (sys.pwd "systest") => "/" join in? false ==) test.assert - ([ls] "ls" run "output" dict.get ==) test.assert + ([ls] "ls" sys.run "output" dict.get ==) test.assert test.report stack.clear - "systest" rmdir + "systest" sys.rmdir