Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adjust page generator for GitHub.

  • Loading branch information...
commit fcfea5dad4337474058f9b477e9b1e73b1395d94 1 parent 77fd54b
@marchof marchof authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+/work
+*.pyc
View
22 .project
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>eclemmasite</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- </buildSpec>
- <natures>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>www.eclemma.org</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
48 generator/eclemmasite.py
@@ -38,27 +38,27 @@
site.item('images/warning.gif', File('content/images/warning.gif'))
site.item('images/jacocoreport.png', File('content/images/jacocoreport.png'))
-site.item('userdoc/index.html', Page('../com.mountainminds.eclemma.doc/pages/userguide.html'))
-site.item('userdoc/launching.html', Page('../com.mountainminds.eclemma.doc/pages/launching.html'))
-site.item('userdoc/coverageview.html', Page('../com.mountainminds.eclemma.doc/pages/coverageview.html'))
-site.item('userdoc/annotations.html', Page('../com.mountainminds.eclemma.doc/pages/annotations.html'))
-site.item('userdoc/coverageproperties.html', Page('../com.mountainminds.eclemma.doc/pages/coverageproperties.html'))
-site.item('userdoc/decorators.html', Page('../com.mountainminds.eclemma.doc/pages/decorators.html'))
-site.item('userdoc/sessions.html', Page('../com.mountainminds.eclemma.doc/pages/sessions.html'))
-site.item('userdoc/importexport.html', Page('../com.mountainminds.eclemma.doc/pages/importexport.html'))
-site.item('userdoc/keyboard.html', Page('../com.mountainminds.eclemma.doc/pages/keyboard.html'))
-site.item('userdoc/preferences.html', Page('../com.mountainminds.eclemma.doc/pages/preferences.html'))
-
-site.item('userdoc/images/annotations.png', File('../com.mountainminds.eclemma.doc/pages/images/annotations.png'))
-site.item('userdoc/images/coverageproperties.png', File('../com.mountainminds.eclemma.doc/pages/images/coverageproperties.png'))
-site.item('userdoc/images/coverageview.png', File('../com.mountainminds.eclemma.doc/pages/images/coverageview.png'))
-site.item('userdoc/images/coverageviewtools.png', File('../com.mountainminds.eclemma.doc/pages/images/coverageviewtools.png'))
-site.item('userdoc/images/coverageviewmenu.png', File('../com.mountainminds.eclemma.doc/pages/images/coverageviewmenu.png'))
-site.item('userdoc/images/launchdialog.png', File('../com.mountainminds.eclemma.doc/pages/images/launchdialog.png'))
-site.item('userdoc/images/decorators.png', File('../com.mountainminds.eclemma.doc/pages/images/decorators.png'))
-site.item('userdoc/images/launchtoolbar.gif', File('../com.mountainminds.eclemma.doc/pages/images/launchtoolbar.gif'))
-site.item('userdoc/images/importdialog.png', File('../com.mountainminds.eclemma.doc/pages/images/importdialog.png'))
-site.item('userdoc/images/exportdialog.png', File('../com.mountainminds.eclemma.doc/pages/images/exportdialog.png'))
+site.item('userdoc/index.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/userguide.html'))
+site.item('userdoc/launching.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/launching.html'))
+site.item('userdoc/coverageview.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/coverageview.html'))
+site.item('userdoc/annotations.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/annotations.html'))
+site.item('userdoc/coverageproperties.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/coverageproperties.html'))
+site.item('userdoc/decorators.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/decorators.html'))
+site.item('userdoc/sessions.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/sessions.html'))
+site.item('userdoc/importexport.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/importexport.html'))
+site.item('userdoc/keyboard.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/keyboard.html'))
+site.item('userdoc/preferences.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/preferences.html'))
+
+site.item('userdoc/images/annotations.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/annotations.png'))
+site.item('userdoc/images/coverageproperties.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/coverageproperties.png'))
+site.item('userdoc/images/coverageview.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/coverageview.png'))
+site.item('userdoc/images/coverageviewtools.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/coverageviewtools.png'))
+site.item('userdoc/images/coverageviewmenu.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/coverageviewmenu.png'))
+site.item('userdoc/images/launchdialog.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/launchdialog.png'))
+site.item('userdoc/images/decorators.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/decorators.png'))
+site.item('userdoc/images/launchtoolbar.gif', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/launchtoolbar.gif'))
+site.item('userdoc/images/importdialog.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/importdialog.png'))
+site.item('userdoc/images/exportdialog.png', File('../eclemma/com.mountainminds.eclemma.doc/pages/images/exportdialog.png'))
site.item('resources.html', Page('content/resources.html'))
@@ -83,9 +83,9 @@
site.item('jacoco/index.html', Page('content/jacoco/index.html'))
site.item('support.html', Page('content/support.html'))
-site.item('faq.html', Page('../com.mountainminds.eclemma.doc/pages/faq.html'))
-site.item('changes.html', Page('../com.mountainminds.eclemma.doc/pages/changes.html'))
-site.item('license.html', Page('../com.mountainminds.eclemma.doc/pages/license.html'))
+site.item('faq.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/faq.html'))
+site.item('changes.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/changes.html'))
+site.item('license.html', Page('../eclemma/com.mountainminds.eclemma.doc/pages/license.html'))
site.item('contact.html', Page('content/contact.html'))
# Site Structure
View
40 generator/gitlog.py
@@ -0,0 +1,40 @@
+"""API to read git log information
+"""
+
+import subprocess
+import os, os.path
+
+_PROPERTIES = (('commithash', '%H'),
+ ('commitdate', '%ci'),
+ ('committername', '%cn'),
+ ('committeremail', '%ce'),
+ ('subject', '%s'))
+
+def get_log_info(file):
+ file = os.path.abspath(file)
+ repo_dir = _get_repo_dir(file)
+ fmt = '%n'.join(map(lambda p : '='.join(p), _PROPERTIES))
+ output = _execute(repo_dir, 'git', 'log', '-1', '--pretty=%s' % fmt, '--name-only', '--', file)
+ lines = output.split('\n')
+ info = {}
+ for l in lines:
+ if not l:
+ # Empty line terminates the properties:
+ break
+ (key, value) = l.split('=')
+ info[key] = value
+ info['path'] = lines[-2]
+ info['repo'] = os.path.basename(repo_dir)
+ return info
+
+def _get_repo_dir(file):
+ dir = os.path.dirname(file)
+ if os.path.isdir(os.path.join(dir, '.git')):
+ return dir
+ else:
+ return _get_repo_dir(dir)
+
+def _execute(cwd, *args):
+ popen = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd)
+ popen.wait()
+ return popen.stdout.read()
View
4 generator/sitegen.py
@@ -6,7 +6,7 @@
import os, os.path, sys, urlparse
import itertools
import genshi, genshi.input, genshi.template
-
+import gitlog
templateloader = genshi.template.TemplateLoader(['./templates'])
@@ -79,7 +79,7 @@ def cond(c, a, b):
cond = cond,
menuitems = site.rootnode.children,
rellink = lambda link: _rellink(path, link),
- meta = lambda name: str(content.select('head/meta[@name="%s"]/@content' % name))
+ properties = gitlog.get_log_info(self.src)
))
page = PAGE.generate(ctx)
page |= LinkCheckFilter(path, site.localpaths())
View
10 templates/page.html
@@ -6,7 +6,7 @@
lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="date" content="${meta('LastChangedDate').split()[1]}" />
+ <meta name="date" content="${properties['commitdate']}" />
<link rel="stylesheet" href="${rellink('book.css')}" type="text/css" />
<link rel="shortcut icon" href="${rellink('favicon.ico')}" type="image/x-icon" />
<title>EclEmma - ${content.select('head/title/text()')}</title>
@@ -44,7 +44,7 @@
</py:for>
<div class="menu" style="margin-top:15pt;background-image:url(${rellink('images/extern.gif')})">
- <a href="http://sourceforge.net/projects/eclemma">SourceForge Home</a>
+ <a href="https://github.com/jacoco">GitHub Home</a>
</div>
<div style="text-align:center;margin-top:0pt;">
<a href="http://www.eclipse.org/org/press-release/20080318_AwardsWinners.php"><img src="${rellink('images/award.jpg')}" width="144" height="120" alt="Eclipse Community Award 2008" style="border:0px solid black"/></a>
@@ -67,14 +67,14 @@
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;">
<tr>
- <td class="footer"><a href="${rellink('license.html')}">Copyright</a> &copy; 2006, 2012 Mountainminds GmbH &amp; Co. KG &middot; Marc R. Hoffmann</td>
+ <td class="footer"><a href="${rellink('license.html')}">Copyright</a> &copy; 2006, 2012 Mountainminds GmbH &amp; Co. KG and Contributors</td>
<td class="footer" style="text-align:right;">
Validate
<a href="http://validator.w3.org/check?uri=http://www.eclemma.org/${path}">XHTML</a>/<a
href="http://jigsaw.w3.org/css-validator/validator?uri=http://www.eclemma.org/${path}">CSS</a> &middot;
Last Modified
- <a href="http://eclemma.svn.sourceforge.net/viewvc/${meta('HeadURL')[54:-2]}?view=log">${meta('LastChangedDate').split()[1]}</a> in
- <a href="http://eclemma.svn.sourceforge.net/viewvc/eclemma?view=rev&amp;revision=${meta('Revision').split()[1]}">rev. ${meta('Revision').split()[1]}</a>
+ <a href="https://github.com/jacoco/${properties['repo']}/blob/${properties['commithash']}/${properties['path']}">${properties['commitdate'].split()[0]}</a> in Commit
+ <a href="https://github.com/jacoco/${properties['repo']}/commit/${properties['commithash']}">${properties['commithash'][0:10]}</a>
</td>
</tr>
</table>
Please sign in to comment.
Something went wrong with that request. Please try again.