about summary refs log tree commit homepage
path: root/GNUmakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-07 15:49:55 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-07 16:00:07 -0700
commitcee939b527e82237f89eb8eece62610854ac888a (patch)
tree019f3874373ea19c4292df73d90c8df85cee634c /GNUmakefile
parent00814d46e9e82fa24d38bd77172143df3757f020 (diff)
downloadclogger-cee939b527e82237f89eb8eece62610854ac888a.tar.gz
Several bikeshed reasons brought me to this point:

* I like the README.html layout more than any default index.html
  even if it's using README content.  Having links on the side
  helps navigation IMHO.

* publish_docs preserves timestamps to improve cache hit rate

* git is used to maintain the manifest at packaging/release-time
  so my changesets have less noise in them

* git is used to generate history files (from tag messages),
  this is a more DRY approach to me.

* I don't like the ".txt" suffix being translated to "_txt.html" in
  URLs.  I don't like the ".txt" suffix in general.

* I don't like Manifest.txt showing up in my RDoc
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile58
1 files changed, 42 insertions, 16 deletions
diff --git a/GNUmakefile b/GNUmakefile
index b57c947..b690ca9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,5 +1,6 @@
 all:: test
 ruby = ruby
+rake = rake
 
 -include local.mk
 
@@ -7,10 +8,6 @@ ifeq ($(DLEXT),) # "so" for Linux
   DLEXT := $(shell $(ruby) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
 endif
 
-ifeq ($(RUBY_VERSION),)
-  RUBY_VERSION := $(shell $(ruby) -e 'puts RUBY_VERSION')
-endif
-
 ext/clogger_ext/Makefile: ext/clogger_ext/clogger.c ext/clogger_ext/extconf.rb
         cd ext/clogger_ext && $(ruby) extconf.rb
 
@@ -29,10 +26,13 @@ test-pure:
 
 test: test-ext test-pure
 
-Manifest.txt:
-        git ls-files > $@+
-        cmp $@+ $@ || mv $@+ $@
-        $(RM) $@+
+History:
+        $(rake) -s history > $@+
+        mv $@+ $@
+
+.manifest: History
+        (git ls-files; for i in $^ $@; do echo $$i; done) | LC_ALL=C sort > $@+
+        mv $@+ $@
 
 VERSION := $(shell git describe 2>/dev/null | sed 's/^v//')
 
@@ -41,6 +41,8 @@ v := /^v$(VERSION)$$/
 vPREV := $(shell git tag -l 2>/dev/null | sed -n -e '$(v)!h' -e '$(v){x;p;q}')
 release_notes := release_notes-$(VERSION).txt
 release_changes := release_changes-$(VERSION).txt
+release-notes: $(release_notes)
+release-changes: $(release_changes)
 $(release_changes): verify
         git diff --stat $(vPREV) v$(VERSION) > $@+
         echo >> $@+
@@ -55,24 +57,48 @@ verify:
         @test -n "$(VERSION)" || { echo >&2 VERSION= not defined; exit 1; }
         git rev-parse --verify refs/tags/v$(VERSION)^{}
         @test -n "$(VISUAL)" || { echo >&2 VISUAL= not defined; exit 1; }
-
-package: verify
         git diff-index --quiet HEAD^0
         test `git rev-parse --verify HEAD^0` = \
              `git rev-parse --verify refs/tags/v$(VERSION)^{}`
-        $(RM) -r pkg
-        unset CLOGGER_EXT; rake package VERSION=$(VERSION)
-        CLOGGER_EXT=1 rake package VERSION=$(VERSION)
+
+pkg/clogger-$(VERSION).gem: .manifest History clogger.gemspec
+        gem build clogger.gemspec
+        mkdir -p pkg
+        mv $(@F) $@
+
+pkg/clogger-$(VERSION).tgz: HEAD = v$(VERSION)
+pkg/clogger-$(VERSION).tgz: .manifest History
+        $(RM) -r $(basename $@)
+        git archive --format=tar --prefix=$(basename $@)/ $(HEAD) | tar xv
+        install -m644 $^ $(basename $@)
+        cd pkg && tar cv $(basename $(@F)) | gzip -9 > $(@F)+
+        mv $@+ $@
+
+package: pkg/clogger-$(VERSION).gem pkg/clogger-$(VERSION).tgz
 
 # not using Hoe's release system since we release 2 gems but only one tgz
-release: package Manifest.txt $(release_notes) $(release_changes)
+release: package $(release_notes) $(release_changes)
         rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
           clogger clogger $(VERSION) pkg/clogger-$(VERSION).gem
         rubyforge add_file \
           clogger clogger $(VERSION) pkg/clogger-$(VERSION).tgz
         rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
           clogger clogger_ext $(VERSION) pkg/clogger_ext-$(VERSION).gem
-        rake post_news
 endif
 
-.PHONY: test doc Manifest.txt release
+doc: .document History
+        rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
+        install -m644 COPYING doc/COPYING
+        cd doc && ln README.html tmp.html && mv tmp.html index.html
+
+# publishes docs to http://clogger.rubyforge.org/
+# this preserves timestamps as best as possible to help HTTP caches out
+# git set-file-times can is here: http://git-scm.org/gitwiki/ExampleScripts
+publish_doc:
+        git set-file-times
+        $(RM) -r doc
+        $(MAKE) doc
+        rsync -av --delete doc/ rubyforge.org:/var/www/gforge-projects/clogger/
+        git ls-files | xargs touch
+
+.PHONY: test doc .manifest release History