Merge lp:~statik/tarmac/web-status-page into lp:tarmac

Proposed by Elliot Murphy
Status: Merged
Approved by: Paul Hummer
Approved revision: 128
Merged at revision: not available
Proposed branch: lp:~statik/tarmac/web-status-page
Merge into: lp:tarmac
Diff against target: None lines
To merge this branch: bzr merge lp:~statik/tarmac/web-status-page
Reviewer Review Type Date Requested Status
Paul Hummer Approve
Review via email: mp+8579@code.launchpad.net

Commit message

Added a simple web interface.

To post a comment you must log in.
Revision history for this message
Elliot Murphy (statik) wrote :

A really basic little wsgi app written using web.py to display the last few lines of the Tarmac log. Apt-get install python-webpy. Horribly simple, but it's a place to start.

lp:~statik/tarmac/web-status-page updated
128. By Elliot Murphy

Change the name back to lowercase so that tarball generated by
setup.py sdist is all lowercase. this is just because it makes
my life easier when packaging.

Revision history for this message
Paul Hummer (rockstar) wrote :

This is great. I wanted horribly simple, and was starting to feel like Twisted was the only way to go (it may be in the long run, but this is good for now).

review: Approve
Revision history for this message
Paul Hummer (rockstar) wrote :

text conflict in setup.py

Revision history for this message
Elliot Murphy (statik) wrote :

Fixed the conflict and pushed an updated branch.

lp:~statik/tarmac/web-status-page updated
129. By Elliot Murphy

Merge from trunk and resolve conflict.

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2009-03-04 06:11:39 +0000
3+++ README 2009-07-10 19:42:24 +0000
4@@ -57,5 +57,10 @@
5 branch is fit to land (i.e. run tests, etc.). I'm not exactly sure of the best
6 way to do this just yet.
7
8+Web Interface
9+=============
10
11+Tarmac includes an optional web interface to display the status of Tarmac.
12+The web interface is a wsgi app that can easily be loaded into mod_wsgi in
13+your apache or nginx server, or run standalone.
14
15
16=== added directory 'templates'
17=== added file 'templates/index.html'
18--- templates/index.html 1970-01-01 00:00:00 +0000
19+++ templates/index.html 2009-07-10 19:42:24 +0000
20@@ -0,0 +1,18 @@
21+$def with (output, errput)
22+
23+<!DOCTYPE HTML>
24+<html lang="en">
25+<head>
26+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
27+ <title>Tarmac - landing branches so you don't have to</title>
28+</head>
29+<body bgcolor="white">
30+
31+<p>The latest output from the Tarmac log is:</p>
32+<p>
33+<pre>
34+$output
35+</pre>
36+</p>
37+</body>
38+</html>
39
40=== added file 'webui.py'
41--- webui.py 1970-01-01 00:00:00 +0000
42+++ webui.py 2009-07-10 19:42:24 +0000
43@@ -0,0 +1,59 @@
44+#!/usr/bin/env python
45+# This file is part of Tarmac.
46+#
47+# Tarmac is free software: you can redistribute it and/or modify
48+# it under the terms of the GNU General Public License version 3 as
49+# published by
50+# the Free Software Foundation.
51+#
52+# Tarmac is distributed in the hope that it will be useful,
53+# but WITHOUT ANY WARRANTY; without even the implied warranty of
54+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55+# GNU General Public License for more details.
56+#
57+# You should have received a copy of the GNU General Public License
58+# along with Tarmac. If not, see <http://www.gnu.org/licenses/>.
59+#
60+# Copyright 2009 Elliot Murphy
61+"""Simple WSGI web application for showing the current Tarmac status."""
62+
63+import sys
64+import subprocess
65+from tarmac.config import TarmacConfig
66+import web
67+
68+urls = (
69+ '/', 'index'
70+)
71+
72+render = web.template.render('templates/')
73+
74+class index(object):
75+ """The main page of the status site."""
76+
77+ def GET(self):
78+ # XXX I cannot figure out how to make the config object from main
79+ # available here.
80+ # statusfile = config.log_file
81+ from tarmac.config import TarmacConfig
82+ statusfile = TarmacConfig(sys.argv[2]).log_file
83+ print statusfile
84+ tail = subprocess.Popen(('tail', '-n40', statusfile),
85+ stdout = subprocess.PIPE,
86+ stderr = subprocess.PIPE)
87+ output, errput = tail.communicate()
88+ return render.index(output, errput)
89+
90+
91+def main():
92+ if len(sys.argv) != 3:
93+ print "Please specify a port number and a project name: ./webui.py 8080 default"
94+ return 1
95+ projectname = sys.argv[2]
96+ config = TarmacConfig(projectname)
97+ app = web.application(urls, globals())
98+ return app.run()
99+
100+
101+if __name__ == "__main__":
102+ sys.exit(main())

Subscribers

People subscribed via source and target branches