From e43a8e6daadf46a2fc8034a510474fcb343703a0 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 28 Jan 2009 14:52:21 -0800 Subject: [PATCH] Move documentation to gerrit.googlecode.com website This makes it easier to store multiple editions of the documentation for Gerrit 2.0, 2.1, and so on. Google AppEngine has a 1,000 file limit, so storing more than a few editions online would be difficult. Signed-off-by: Shawn O. Pearce --- Documentation/.gitignore | 3 +-- Documentation/Makefile | 45 ++++++++++++++++++++++----------------- Documentation/app.yaml | 22 ------------------- Documentation/redirect.py | 21 ------------------ 4 files changed, 26 insertions(+), 65 deletions(-) delete mode 100644 Documentation/app.yaml delete mode 100644 Documentation/redirect.py diff --git a/Documentation/.gitignore b/Documentation/.gitignore index ec0066893b..8a3da24187 100644 --- a/Documentation/.gitignore +++ b/Documentation/.gitignore @@ -1,3 +1,2 @@ *.html -/release-gae -/config.mak +/.published diff --git a/Documentation/Makefile b/Documentation/Makefile index 001b0e0f05..0b1f9849cf 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -1,35 +1,40 @@ -ifeq ($(shell uname),Darwin) - SDK = /usr/local/bin -else - SDK = $(HOME)/google_appengine -endif - DOC_HTML = $(patsubst %.txt,%.html,$(wildcard *.txt)) ASCIIDOC = asciidoc ASCIIDOC_EXTRA = -PYSDK = python2.5 -APPCFG = $(PYSDK) $(SDK)/appcfg.py $(APPCFG_OPTS) -e '$(ADMIN)' -R_WEB = release-gae -APPID = gerrit-documentation +SVN = svn +PUB_ROOT = https://gerrit.googlecode.com/svn/documentation +LOCAL_ROOT = .published --include config.mak +DOC_VERS := $(shell git describe HEAD) +DOC_VMM := $(shell sh -c "echo $(DOC_VERS) | perl -pe 's,^v(\d+\.\d+)[\.-].*\$$,\$$1,'") +PUB_DIR = $(PUB_ROOT)/$(DOC_VMM) all: html html: $(DOC_HTML) update: html - @rm -rf $(R_WEB) - @mkdir -p $(R_WEB)/Documentation - cp app.yaml redirect.py $(R_WEB) - cp ../appjar/src/main/java/com/google/gerrit/public/favicon.ico $(R_WEB) - cp *.html $(R_WEB)/Documentation - git describe HEAD >$(R_WEB)/application_version - perl -pi -e 's/(application:).*/$$1 $(APPID)/' $(R_WEB)/app.yaml - $(APPCFG) update $(R_WEB) + -rm -rf $(LOCAL_ROOT) + $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT) + rm -f $(LOCAL_ROOT)/*.html + cp *.html $(LOCAL_ROOT) + cd $(LOCAL_ROOT) && \ + r=`$(SVN) status | perl -ne 'print if s/^! *//' ` && \ + if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \ + a=`$(SVN) status | perl -ne 'print if s/^\? *//' ` && \ + if [ -n "$$a" ]; then \ + $(SVN) add $$r && \ + $(SVN) propset svn:mime-type text/html $$r ; \ + fi && \ + $(SVN) commit -m "Updated documentation $(DOC_VMM) to $(DOC_VERS)" + -rm -rf $(LOCAL_ROOT) + +new-docs: + $(SVN) mkdir -m "Create documentation $(DOC_VMM)" $(PUB_DIR) clean: - rm -f *.html $(R_WEB) + rm -f *.html + rm -rf $(LOCAL_ROOT) $(DOC_HTML): %.html : %.txt rm -f $@+ $@ diff --git a/Documentation/app.yaml b/Documentation/app.yaml deleted file mode 100644 index e8a8c29e62..0000000000 --- a/Documentation/app.yaml +++ /dev/null @@ -1,22 +0,0 @@ -application: gerrit-documentation -version: 1 -runtime: python -api_version: 1 - -default_expiration: 5m - -handlers: -- url: /application_version - mime_type: text/plain - static_files: application_version - upload: application_version - -- url: /favicon.ico - static_files: favicon.ico - upload: favicon.ico - -- url: /Documentation - static_dir: Documentation - -- url: .* - script: redirect.py diff --git a/Documentation/redirect.py b/Documentation/redirect.py deleted file mode 100644 index f2ceac3673..0000000000 --- a/Documentation/redirect.py +++ /dev/null @@ -1,21 +0,0 @@ -# Simple redirect for / to Documentation/index.html - -from google.appengine.ext import webapp -from google.appengine.ext.webapp.util import run_wsgi_app - -def _CreateApplication(): - return webapp.WSGIApplication([ - (r'^/$', RedirectDocumentation), - ], - debug=False) - -class RedirectDocumentation(webapp.RequestHandler): - def get(self): - self.redirect('Documentation/index.html', permanent=True) - -def main(): - run_wsgi_app(application) - -if __name__ == '__main__': - application = _CreateApplication() - main()