Skip to content

Commit

Permalink
plugin support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Tardy committed May 25, 2013
1 parent cd23d1e commit 304dc9f
Show file tree
Hide file tree
Showing 26 changed files with 1,055 additions and 122 deletions.
1 change: 1 addition & 0 deletions master/buildbot/config.py
Expand Up @@ -103,6 +103,7 @@ def __init__(self):
self.www = dict(
port=None,
url='http://localhost:8080/',
plugins=dict()
)

_known_config_keys = set([
Expand Down
12 changes: 10 additions & 2 deletions master/buildbot/www/service.py
Expand Up @@ -16,8 +16,9 @@
import pkg_resources
from twisted.internet import defer
from twisted.application import strports, service
from twisted.web import server
from twisted.web import server, static
from buildbot import config
from buildbot.util import json
from buildbot.www import rest, ws, sse

class WWWService(config.ReconfigurableServiceMixin, service.MultiService):
Expand Down Expand Up @@ -81,9 +82,16 @@ def reconfigService(self, new_config):
yield config.ReconfigurableServiceMixin.reconfigService(self,
new_config)


def setupSite(self, new_config):
root = self.apps['base'].resource
for key, plugin in new_config.www['plugins'].items():
if not key in self.apps:
raise RuntimeError("could not find plugin %s; is it installed?" % (key,))
root.putChild(key, self.apps[key].resource)

# /config.js
root.putChild('config.js', static.Data("this.config = " + json.dumps(new_config.www),
"text/javascript"))

# /api
root.putChild('api', rest.RestRootResource(self.master))
Expand Down
6 changes: 3 additions & 3 deletions www/Gruntfile.coffee
Expand Up @@ -143,6 +143,8 @@ module.exports = (grunt) ->
expand: true
,
'./buildbot_www/index.html': './.temp/index.min.html'
,
'./buildbot_www/require.js': './src/scripts/libs/require.js'
]
# Task is run when the watched index.template file is modified.
index:
Expand Down Expand Up @@ -227,8 +229,6 @@ module.exports = (grunt) ->
# RequireJS optimizer configuration for both scripts and styles.
# This configuration is only used in the 'prod' build.
# The optimizer will scan the main file, walk the dependency tree, and write the output in dependent sequence to a single file.
# Since RequireJS is not being used outside of the main file or for dependency resolution (this is handled by AngularJS), RequireJS is not needed for final output and is excluded.
# RequireJS is still used for the 'dev' build.
# The main file is used only to establish the proper loading sequence.
requirejs:
scripts:
Expand All @@ -246,7 +246,7 @@ module.exports = (grunt) ->
return '' if shouldExcludeModule

contents
optimize: 'uglify'
optimize: 'uglify2'
out: './.temp/scripts/scripts.min.js'
preserveLicenseComments: false
skipModuleInsertion: true
Expand Down
3 changes: 1 addition & 2 deletions www/buildbot_www.py
Expand Up @@ -12,13 +12,12 @@
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members
# Portions copyright The Dojo Foundation

import os
import sys

from twisted.web import static


def sibpath(*elts):
return os.path.join(os.path.dirname(__file__), *elts)

Expand Down
9 changes: 9 additions & 0 deletions www/sample_plugin/.gitignore
@@ -0,0 +1,9 @@
# All files to globally ignore
buildbot_www
buildbot_www_test
.temp
package.json
bower.json
VERSION
node_modules
components

0 comments on commit 304dc9f

Please sign in to comment.