Add simple script to make an index page.
Change-Id: I2e8cb84fd26a9e45f9d6cbf42682e6b94d207413
This commit is contained in:
parent
214eb90d4f
commit
6781dd75bb
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
output
|
18
README.rst
Normal file
18
README.rst
Normal file
@ -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.
|
86
index.html
Normal file
86
index.html
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
|
||||||
|
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<title>OpenStack Project Infrastructure Publications</title>
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<link
|
||||||
|
href="http://fonts.googleapis.com/css?family=PT+Sans&subset=latin"
|
||||||
|
rel="stylesheet" type="text/css" />
|
||||||
|
<!-- Framework CSS -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="http://openstack.org/themes/openstack/css/blueprint/screen.css"
|
||||||
|
type="text/css" media="screen, projection" />
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="http://openstack.org/themes/openstack/css/blueprint/print.css"
|
||||||
|
type="text/css" media="print" />
|
||||||
|
<!--[if lt IE 8]><link rel="stylesheet" href="http://openstack.org/themes/openstack/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
|
||||||
|
<!-- OpenStack Specific CSS -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="http://openstack.org/themes/openstack/css/main.css"
|
||||||
|
type="text/css" media="screen, projection, print" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div id="header">
|
||||||
|
<div class="span-5">
|
||||||
|
<h1 id="logo"><a href="/">OpenStack</a></h1>
|
||||||
|
</div>
|
||||||
|
<div class="span-19 last blueLine">
|
||||||
|
<div id="navigation" class="span-19">
|
||||||
|
<ul id="Menu1">
|
||||||
|
<li><a href="http://www.openstack.org/"
|
||||||
|
title="Go to the OpenStack Home page"
|
||||||
|
>Home</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://www.openstack.org/software/"
|
||||||
|
title="About OpenStack"
|
||||||
|
class="link">About</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://www.openstack.org/user-stories/"
|
||||||
|
title="Read stories about companies that use OpenStack to get work done."
|
||||||
|
class="link">User Stories</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://www.openstack.org/community/"
|
||||||
|
title="Go to the OpenStack Community page"
|
||||||
|
class="link">Community</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://www.openstack.org/profile/"
|
||||||
|
title="Edit your OpenStack community profile"
|
||||||
|
class="link">Profile</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://www.openstack.org/blog/"
|
||||||
|
title="Go to the OpenStack Blog"
|
||||||
|
>Blog</a></li>
|
||||||
|
<li><a href="http://wiki.openstack.org/"
|
||||||
|
title="Go to the OpenStack Wiki"
|
||||||
|
>Wiki</a></li>
|
||||||
|
<li><a
|
||||||
|
href="http://docs.openstack.org/glossary/content/glossary.html"
|
||||||
|
title="See definitions of OpenStack terms"
|
||||||
|
>Glossary</a></li>
|
||||||
|
<li><a href="http://docs.openstack.org/"
|
||||||
|
title="Go to the OpenStack Documentation"
|
||||||
|
class="current"
|
||||||
|
>Documentation</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Page Content -->
|
||||||
|
<div class="container">
|
||||||
|
<h1>OpenStack Project Infrastructure Publications</h3>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<h2>Current Publications</h2>
|
||||||
|
{current}
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div class="container">
|
||||||
|
<h2>Previous Publications</h2>
|
||||||
|
{previous}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
75
make-index
Executable file
75
make-index
Executable file
@ -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 += '<a href="%s/">%s</a><br/>\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 += '<a href="%s/">%s: %s</a><br/>\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()
|
Loading…
Reference in New Issue
Block a user