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

Subscribers

People subscribed via source and target branches