diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +output diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..7380870 --- /dev/null +++ b/README.rst @@ -0,0 +1,18 @@ +Publications Repository +======================= + +Each publication should get its own branch and is a living document. +Each branch should have a README.rst file where the first line is the +title of the presentation. + +Each time a publication is presented or published, the branch should +be tagged (with a signed, annotated tag). The first line of the tag +message should be the title of the event or publication. For example, +if the presentation "overview" was given at LCA 2013, you might tag it +with: + + git tag -s -m "linux.conf.au, 2013" overview + +The 'make-index' script will create an index page based on index.html, +and all current branches and tags in the repo and their README.rst +files. diff --git a/index.html b/index.html new file mode 100644 index 0000000..d14d6a8 --- /dev/null +++ b/index.html @@ -0,0 +1,86 @@ + + + + + OpenStack Project Infrastructure Publications + + + + + + + + + + +
+ +
+ +
+

OpenStack Project Infrastructure Publications

+
+
+

Current Publications

+ {current} +
+
+
+

Previous Publications

+ {previous} +
+ + diff --git a/make-index b/make-index new file mode 100755 index 0000000..5132396 --- /dev/null +++ b/make-index @@ -0,0 +1,75 @@ +#!/usr/bin/env python + +# Copyright 2013 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os +import subprocess + +def run_local(cmd, cwd='.', env={}): + print "Running:", cmd + newenv = os.environ + newenv.update(env) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=cwd, + stderr=subprocess.STDOUT, env=newenv) + (out, nothing) = p.communicate() + return (p.returncode, out.strip()) + +def git_branches(): + branches = [] + r, branch_list = run_local(['git', 'branch', '-a']) + for branch in branch_list.split("\n"): + branch = branch.strip() + if not branch.startswith('remotes/origin'): + continue + branches.append(branch) + return branches + +def git_tags(): + r, tag_list = run_local(['git', 'tag', '-n']) + return tag_list.split('\n') + +current = '' +previous = '' + +for branch in git_branches(): + if branch.startswith('remotes/origin/master'): + continue + if branch.startswith('remotes/origin/HEAD'): + continue + if '->' in branch: + continue + r,o = run_local(['git', 'show', branch+':README.rst']) + if not r: + title = o.split('\n')[0] + name = branch[len('remotes/origin/'):] + print "Adding branch %s: %s" % (name, title) + current += '%s
\n' % (name, title) + + +for tagline in git_tags(): + tag, tag_title = [x.strip() for x in tagline.split(' ', 1)] + r,o = run_local(['git', 'show', tag+':README.rst']) + if not r: + title = o.split('\n')[0] + print "Adding tag %s: %s: %s" % (tag, tag_title, title) + previous += '%s: %s
\n' % (tag, tag_title, title) + + +if not os.path.exists('output'): + os.mkdir('output') + +out = open('output/index.html', 'w') +out.write(open('index.html').read().format(current=current, previous=previous)) +out.close()