2
# This file is part of Tarmac.
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
7
# the Free Software Foundation.
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.
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/>.
17
# Copyright 2009 Elliot Murphy
18
"""Simple WSGI web application for showing the current Tarmac status."""
22
from tarmac.config import TarmacConfig
29
render = web.template.render('templates/')
32
"""The main page of the status site."""
35
# XXX I cannot figure out how to make the config object from main
37
# statusfile = config.log_file
38
from tarmac.config import TarmacConfig
39
statusfile = TarmacConfig(sys.argv[2]).log_file
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)
49
if len(sys.argv) != 3:
50
print "Please specify a port number and a project name: ./webui.py 8080 default"
52
projectname = sys.argv[2]
53
config = TarmacConfig(projectname)
54
app = web.application(urls, globals())
58
if __name__ == "__main__":