api: remove some hard-coded version numbers

This commit is contained in:
Simon Michael 2019-02-03 15:18:42 -08:00
parent e89c3752c4
commit 47f3ebf25a
2 changed files with 7 additions and 8 deletions

View File

@ -173,7 +173,6 @@ DOCSOURCEFILES:= \
# files which should be updated when the version changes
VERSIONSENSITIVEFILES=\
$(HPACKFILES) \
hledger-api/hledger-api.hs \
doc/lib.m4 \
# # file(s) which require recompilation for a build to have an up-to-date version string
@ -1199,11 +1198,6 @@ updatedate: setdate $(call def-help,updatedate, set date in manuals to current m
perl -pe "s/(hledger(-\w+)?) *>=? *((\d+\.)*\d+) *$$/\$$1 >=$(VERSION)/" -i $@ # hledgerX >= A
perl -pe "s/(hledger(-\w+)?) *>=? *((\d+\.)*\d+) *&& *< *((\d+\.)*\d+) *$$/\$$1 >=$(VERSION) && <\$$5/" -i $@ # hledgerX >= A && < B
# update hledger-api's version strings
hledger-api/hledger-api.hs: $(VERSIONFILE)
perl -pe "s/(hledgerApiVersion=)\"((\d+\.)*\d+)\" *$$/\$$1\"$(VERSION)\"/" -i $@
perl -pe "s/(.*?hledger-api +)((\d+\.)*\d+)(.*)$$/\$${1}$(VERSION)\$$4/" -i $@
# update version string used in generated docs
doc/lib.m4: $(VERSIONFILE)
perl -pe "s/^(m4_define\({{_version_}}, *{{)((\d+\.)*\d+)(}}\)m4_dnl *)$$/\$${1}$(VERSION)\$${4}/" -i $@

View File

@ -37,12 +37,17 @@ import Text.Printf
import Hledger.Query
import Hledger.Cli hiding (Reader, version)
hledgerApiVersion="1.13"
#ifdef VERSION
hledgerApiVersion = VERSION
#else
hledgerApiVersion = "dev build"
#endif
-- https://github.com/docopt/docopt.hs#readme
-- XXX VERSION is "X.Y" and the quotes appear in the output
doc :: Docopt
doc = [docopt|
hledger-api 1.13
hledger-api VERSION
Serves hledger data and reports as a JSON web API.