Permalink
Browse files

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 <sit@emilsit.net>
  • Loading branch information...
sit committed Mar 22, 2009
1 parent ad40ef0 commit 0b3d9109deaf698f8b84b6850469e98b2e75f47f
Showing with 5 additions and 2 deletions.
  1. +2 −1 Makefile
  2. +3 −1 todo.sh
View
@@ -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)/
View
@@ -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/^ //' <<EndVersion
- TODO.TXT Command Line Interface
+ TODO.TXT Command Line Interface v$VERSION
+
Latest version: http://github.com/ginatrapani/todo.txt-cli/tree/master
First release: 5/11/2006
Conceived and released by: Gina Trapani (http://ginatrapani.org)

0 comments on commit 0b3d910

Please sign in to comment.