var axe = axe || {};
axe.plugins = {};

function Plugin(spec) {
	'use strict';
	this._run = spec.run;
	this._registry = {};
	spec.commands.forEach(function (command) {
		axe._audit.registerCommand(command);
	});
}

Plugin.prototype.run = function () {
	'use strict';
	return this._run.apply(this, arguments);
};

Plugin.prototype.cleanup = function (done) {
	'use strict';
	var q = utils.queue();
	var that = this;
	Object.keys(this._registry).forEach(function (key) {
		q.defer(function (done) {
			that._registry[key].cleanup(done);
		});
	});
	q.then(function () {
		done();
	});
};

Plugin.prototype.add = function (impl) {
	'use strict';
	this._registry[impl.id] = impl;
};

axe.registerPlugin = function (plugin) {
	'use strict';
	axe.plugins[plugin.id] = new Plugin(plugin);
};
@@ -95,16 +95,47 @@
 ec.run;%0A
+%09this._collect = spec.collect;%0A
 %09this._r
@@ -333,24 +333,130 @@
 ments);%0A%7D;%0A%0A
+Plugin.prototype.collect = function () %7B%0A%09'use strict';%0A%09return this._collect.apply(this, arguments);%0A%7D;%0A%0A
 Plugin.proto

add a collect function to the Plugin API