all repos — min @ 1d56c1646c99fbc321b36da7c8dd5d23e886a7c1

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
#!/usr/bin/env min

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

yaml-cfg fread from-yaml :config
config /version :old-version
(
  :new-version
  config new-version %version @config
  config to-yaml yaml-cfg fwrite
) :update-yaml-config
(
  :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
) :update-site-config

; Module tasks
{}
(
  "" :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
) %set
(
  old-version semver-inc-major :new-version
  new-version update-yaml-config
  new-version update-site-config
) %major
(
  old-version semver-inc-minor :new-version
  new-version update-yaml-config
  new-version update-site-config
) %minor
(
  old-version semver-inc-patch :new-version
  new-version update-yaml-config
  new-version update-site-config
) %patch
+version-tasks