all repos — min @ fe19e56086145a6c8d4f9abf075d507abe3c0b7e

A small but practical concatenative programming language.

tasks/version.min

 1
#!/usr/bin/env min

"min.yml" :yaml-cfg
"site/settings.json" :json-site-cfg

yaml-cfg fread from-yaml :config
config /version :old-version

(
  symbol update-yaml-config
  ('sym :new-version ==>)
  (
    config new-version %version @config
    config to-yaml yaml-cfg fwrite
  )  
) ::
;; Sets the version in the min.yml file to new-version.

(
  symbol update-site-config
  ('sym :new-version ==>)
  (
    json-site-cfg fread from-json :site-config
    site-config new-version %version @site-config
    site-config to-json json-site-cfg fwrite
  )
) ::
;; Updates the version of the web site to new-version.

#| Tasks |#

(
  symbol set
  (==>)
  (
    "" :new-version
    false :valid-semver
    (valid-semver not)
    (
      "New version" ask @new-version
      new-version semver? @valid-semver
    ) while
    new-version update-yaml-config
    new-version update-site-config
  )
) ::
;; Asks and sets the new min version where appropriate.

(
  symbol major
  (==>)
  (
    old-version semver-inc-major :new-version
    new-version update-yaml-config
    new-version update-site-config
  )
) ::
;; Increments the min major version.

(
  symbol minor
  (==>)
  (
    old-version semver-inc-minor :new-version
    new-version update-yaml-config
    new-version update-site-config
  )
) ::
;; Increments the min minor version.

(
  symbol patch
  (==>)
  (
    old-version semver-inc-patch :new-version
    new-version update-yaml-config
    new-version update-site-config
  )
) ::
;; Increments the min patch version.