summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wall <richard@aziz>2010-08-22 11:52:03 +0100
committerRichard Wall <richard@aziz>2010-08-22 11:52:03 +0100
commit5c9261912a5d3f66d0edec02b1fb003b5d20629b (patch)
treec7926bedb886e47621bd4d93b0a4cdf54e0964ce
parent5c1f11e97068c8df787a9eef987ec486431c7baf (diff)
Add a documentation build script
-rwxr-xr-xbin/build-apidocs10
-rw-r--r--jarmonbuild/commands.py75
-rw-r--r--jarmonbuild/yuidoc_template/assets/ac-js (renamed from build/yuidoc_template/assets/ac-js)0
-rw-r--r--jarmonbuild/yuidoc_template/assets/api-js (renamed from build/yuidoc_template/assets/api-js)0
-rw-r--r--jarmonbuild/yuidoc_template/assets/api.css (renamed from build/yuidoc_template/assets/api.css)0
-rw-r--r--jarmonbuild/yuidoc_template/assets/bg_hd.gif (renamed from build/yuidoc_template/assets/bg_hd.gif)bin96 -> 96 bytes
-rw-r--r--jarmonbuild/yuidoc_template/assets/reset-fonts-grids-min.css (renamed from build/yuidoc_template/assets/reset-fonts-grids-min.css)0
-rw-r--r--jarmonbuild/yuidoc_template/classmap.tmpl (renamed from build/yuidoc_template/classmap.tmpl)0
-rw-r--r--jarmonbuild/yuidoc_template/index.tmpl (renamed from build/yuidoc_template/index.tmpl)0
-rw-r--r--jarmonbuild/yuidoc_template/main.tmpl (renamed from build/yuidoc_template/main.tmpl)0
10 files changed, 85 insertions, 0 deletions
diff --git a/bin/build-apidocs b/bin/build-apidocs
new file mode 100755
index 0000000..a4ff988
--- /dev/null
+++ b/bin/build-apidocs
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+import os
+import sys
+
+# Add the current branch to the python path
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from jarmonbuild import BuildApidocsCommand
+
+raise SystemExit(BuildApidocsCommand().main())
diff --git a/jarmonbuild/commands.py b/jarmonbuild/commands.py
new file mode 100644
index 0000000..e78a78e
--- /dev/null
+++ b/jarmonbuild/commands.py
@@ -0,0 +1,75 @@
+import hashlib
+import os
+import sys
+
+from subprocess import check_call
+from tempfile import gettempdir
+from urllib2 import urlopen
+from zipfile import ZipFile
+
+
+YUIDOC_URL = 'http://yuilibrary.com/downloads/yuidoc/yuidoc_1.0.0b1.zip'
+YUIDOC_MD5 = 'cd5545d2dec8f7afe3d18e793538162c'
+
+class BuildApidocsCommand(object):
+ def __init__(self, stdout=sys.stdout, stderr=sys.stderr):
+ self.stdout = stdout
+ self.stderr = stderr
+
+ def log(self, message, newline=os.linesep):
+ self.stderr.write(''.join((message, newline)))
+
+ def main(self, argv=sys.argv):
+ # setup working dir
+ tmpdir = os.path.join(gettempdir(), 'jarmonbuild')
+ if not os.path.isdir(tmpdir):
+ os.mkdir(tmpdir)
+
+ # download and cache yuidoc
+ yuizip_path = os.path.join(tmpdir, os.path.basename(YUIDOC_URL))
+ if os.path.exists(yuizip_path):
+ def producer():
+ self.log('Using cached YUI doc')
+ yield open(yuizip_path).read()
+ else:
+ def producer():
+ with open(yuizip_path, 'w') as yuizip:
+ self.log('Downloading YUI Doc', newline='')
+ download = urlopen(YUIDOC_URL)
+ while True:
+ bytes = download.read(1024*10)
+ if not bytes:
+ self.log('')
+ break
+ else:
+ yuizip.write(bytes)
+ self.log('.', newline='')
+ yield bytes
+
+ checksum = hashlib.md5()
+ for bytes in producer():
+ checksum.update(bytes)
+
+ if checksum.hexdigest() != YUIDOC_MD5:
+ sys.log('checksum mismatch')
+
+ # extract yuidoc folder from the downloaded zip file
+ zip = ZipFile(yuizip_path)
+ zip.extractall(
+ tmpdir, (m for m in zip.namelist() if m.startswith('yuidoc')))
+
+ workingbranch_dir = os.path.join(os.path.dirname(__file__), '..')
+ # Use the yuidoc script that we just extracted to generate new docs
+ check_call((
+ sys.executable,
+ os.path.join(tmpdir, 'yuidoc', 'bin', 'yuidoc.py'),
+ workingbranch_dir,
+ '-p', os.path.join(workingbranch_dir, 'docs', 'apidocs'),
+ '-o', os.path.join(workingbranch_dir, 'docs', 'apidocs'),
+ '-t', os.path.join(
+ workingbranch_dir, 'jarmonbuild', 'yuidoc_template'),
+ '-v', '10.8',
+ '-Y', '2',
+ '--project=Jarmon',
+ '--projecturl=http://www.launchpad.net/jarmon'
+ ))
diff --git a/build/yuidoc_template/assets/ac-js b/jarmonbuild/yuidoc_template/assets/ac-js
index 15a6dff..15a6dff 100644
--- a/build/yuidoc_template/assets/ac-js
+++ b/jarmonbuild/yuidoc_template/assets/ac-js
diff --git a/build/yuidoc_template/assets/api-js b/jarmonbuild/yuidoc_template/assets/api-js
index e8132e0..e8132e0 100644
--- a/build/yuidoc_template/assets/api-js
+++ b/jarmonbuild/yuidoc_template/assets/api-js
diff --git a/build/yuidoc_template/assets/api.css b/jarmonbuild/yuidoc_template/assets/api.css
index 878a0b1..878a0b1 100644
--- a/build/yuidoc_template/assets/api.css
+++ b/jarmonbuild/yuidoc_template/assets/api.css
diff --git a/build/yuidoc_template/assets/bg_hd.gif b/jarmonbuild/yuidoc_template/assets/bg_hd.gif
index c10acba..c10acba 100644
--- a/build/yuidoc_template/assets/bg_hd.gif
+++ b/jarmonbuild/yuidoc_template/assets/bg_hd.gif
Binary files differ
diff --git a/build/yuidoc_template/assets/reset-fonts-grids-min.css b/jarmonbuild/yuidoc_template/assets/reset-fonts-grids-min.css
index 3d81c15..3d81c15 100644
--- a/build/yuidoc_template/assets/reset-fonts-grids-min.css
+++ b/jarmonbuild/yuidoc_template/assets/reset-fonts-grids-min.css
diff --git a/build/yuidoc_template/classmap.tmpl b/jarmonbuild/yuidoc_template/classmap.tmpl
index 34525a4..34525a4 100644
--- a/build/yuidoc_template/classmap.tmpl
+++ b/jarmonbuild/yuidoc_template/classmap.tmpl
diff --git a/build/yuidoc_template/index.tmpl b/jarmonbuild/yuidoc_template/index.tmpl
index 0d4f505..0d4f505 100644
--- a/build/yuidoc_template/index.tmpl
+++ b/jarmonbuild/yuidoc_template/index.tmpl
diff --git a/build/yuidoc_template/main.tmpl b/jarmonbuild/yuidoc_template/main.tmpl
index 74de127..74de127 100644
--- a/build/yuidoc_template/main.tmpl
+++ b/jarmonbuild/yuidoc_template/main.tmpl