From 0b3d9109deaf698f8b84b6850469e98b2e75f47f Mon Sep 17 00:00:00 2001 From: Emil Sit Date: Sun, 22 Mar 2009 08:13:25 -0400 Subject: [PATCH] todo.sh: Generate version info at dist time. When generating the distribution files, prepare todo.sh by subbing in the current version so that users will get a proper version number. Tries to detect VERSION-FILE for running from the development directory but this doesn't work well when $PWD is not the top of the git repo. Signed-off-by: Emil Sit --- Makefile | 3 ++- todo.sh | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 92a81bd..666c7f0 100644 --- a/Makefile +++ b/Makefile @@ -13,12 +13,13 @@ VERSION-FILE: .FORCE-VERSION-FILE todo.sh: VERSION-FILE # For packaging -DISTFILES := README todo.cfg todo.sh +DISTFILES := README todo.cfg DISTNAME=todo.sh-$(VERSION) dist: $(DISTFILES) todo.sh mkdir -p $(DISTNAME) cp -f $(DISTFILES) $(DISTNAME)/ + sed -e 's/@DEV_VERSION@/'$(VERSION)'/' todo.sh > $(DISTNAME)/todo.sh tar cf $(DISTNAME).tar $(DISTNAME)/ gzip -f -9 $(DISTNAME).tar zip -9r $(DISTNAME).zip $(DISTNAME)/ diff --git a/todo.sh b/todo.sh index 8d44ea2..a138590 100755 --- a/todo.sh +++ b/todo.sh @@ -3,8 +3,10 @@ # NOTE: Todo.sh requires the todo.cfg configuration file to run. # Place the todo.cfg file in your home directory or use the -d option for a custom location. +[ -f VERSION-FILE ] && . VERSION-FILE || VERSION="@DEV_VERSION@" version() { sed -e 's/^ //' <