all repos — min @ 6b549d0328a9a1cedf250faba3dead56863f7dee

A small but practical concatenative programming language.

tasks/version.min

 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
 74
 75
 76
 77
 78
 79
 80
#!/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.