all repos — min @ 6ede9f1cf313d3b304ac10c7ce2e33fc0ba53450

A small but practical concatenative programming language.

Fixes + added release announcement.
h3rald h3rald@h3rald.com
Sun, 13 Oct 2024 13:54:48 +0200
commit

6ede9f1cf313d3b304ac10c7ce2e33fc0ba53450

parent

4b3bae0761ed70e780a5116a745372ea8c78a3fc

3 files changed, 250 insertions(+), 5 deletions(-)

jump to
M next-release.mdnext-release.md

@@ -69,10 +69,6 @@ - **xml** module: renamed **xquery** to **xml.query**

- **xml** module: renamed **xqueryall** to **xml.query-all** - The **prompt** symbol is no longer unsealed. -### New Features - ### Fixes and Improvements * Upgraded OpenSSL to v3.3.2. - -
A site/contents/news/v0.45.0.md

@@ -0,0 +1,89 @@

+----- +content-type: "post" +title: "Version 0.45.0 released" +slug: v0.45.0 +date: 2024-10-13 +----- +{@ _defs_.md || 0 @} + +This is by far the release with most breaking changes in a long time. The ideas behind all this are +* Leveraging the new dot notation to access symbols in modules +* Avoid polluting global scope with too many imported symbols +* Avoid using prefixed symbols like `fread` (now `fs.read`) or `dget` (now `dict.get`) to avoid collisions in the global scope + +The good news is... you can run `min run min-upgrade <folder>` to migrate all your code automatically! + +### BREAKING CHANGES + +- All symbols defined in the **num** module have been moved to the **global** module. +- All symbols defined in the **logic** module have been moved to the **global** module. +- All symbols defined in the **str** module have been moved to the **global** module. +- All symbols defined in the **seq** module have been moved to the **global** module. +- Removed **lambdabind** (use **lambda-bind** instead). +- The **stack** module is no longer imported. +- **stack** module: removed symbol **id**. +- **stack** module: renamed **clear-stack** to **clear**. +- **stack** module: removed **clearstack** (use **stack.clear** instead). +- **stack** module: renamed **get-stack** to **get**. +- **stack** module: removed **getstack** (use **stack.get** instead). +- **stack** module: renamed **set-stack** to **set**. +- **stack** module: removed **setstack** (use **stack.set** instead). +- The **io** module is no longer imported. +- **io** module: renamed **fwrite** and **write** to **fs.write** +- **io** module: renamed **fread** and **read** to **fs.read** +- **io** module: renamed **fappend** to **fs.append** +- **io** module: moved **print** to the **global** module. +- **io** module: removed **newline** (use `"" puts!` instead). +- The **fs** module is no longer imported. +- **fs** module: renamed **fperms** to **fs.permissions** +- **fs** module: renamed **fsize** to **fs.size** +- **fs** module: renamed **fstats** to **fs.stats** +- **fs** module: renamed **ftype** to **fs.type** +- The **time** module is no longer imported. +- **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** 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. +- The **dstore** module has been renamed to **store**, and is no longer imported. +- **store** module: renamed **dsinit** to **store.init** +- **store** module: renamed **dsget** to **store.get** +- **store** module: renamed **dshas?** to **store.has?** +- **store** module: renamed **dsput** to **store.put** +- **store** module: renamed **dspost** to **store.post** +- **store** module: renamed **dsdelete** to **store.delete** +- **store** module: renamed **dsquery** to **store.query** +- **store** module: renamed **dswrite** to **store.write** +- **store** module: renamed **dsread** to **store.read** +- The **crypto** module is no longer imported. +- The **math** module is no longer imported. +- **math** module: renamed **r2g** to **math.r2d** +- The **net** module is no longer imported. +- The **http** module is no longer imported. +- The **xml** module is no longer imported. +- **xml** module: renamed **xcomment** to **xml.comment** +- **xml** module: renamed **xentity** to **xml.entity** +- **xml** module: renamed **xtext** to **xml.text** +- **xml** module: renamed **xentity2utf8** to **xml.entity2utf8** +- **xml** module: renamed **xcdata** to **xml.cdata** +- **xml** module: renamed **xescape** to **xml.escape** +- **xml** module: renamed **xelement** to **xml.element** +- **xml** module: renamed **xquery** to **xml.query** +- **xml** module: renamed **xqueryall** to **xml.query-all** +- The **prompt** symbol is no longer unsealed. + +### Fixes and Improvements + +* Upgraded OpenSSL to v3.3.2.
M tasks/github.mintasks/github.min

@@ -1,1 +1,161 @@

-#!/usr/bin/env min "_helpers" require :helpers 'helpers import "next-release.md" fs.read xml.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 http.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. +#!/usr/bin/env min + +"_helpers" require :helpers 'helpers import + +"next-release.md" fs.read xml.escape 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 integer 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 + :req + ;req to-json puts! + req http.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.