kaffee
Version:
Kaffee is a software project management tool similar to Maven and is written in Coffeescript. Kaffee allows you to compile, test, minify and many other tasks to make building your application simple and fun again.
83 lines (63 loc) • 2.46 kB
JavaScript
(function() {
var DefaultPlugin, Fs, Path,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Fs = require("fs");
Path = require("path");
/*
The {@link DefaultPlugin} class is the built-in Kaffee plugin and provides basic goals like "clean".
@author Fabian M. <mail.fabianm@gmail.com>
*/
DefaultPlugin = (function(_super) {
__extends(DefaultPlugin, _super);
/*
Constructs a new {@link DefaultPlugin} instance.
@since 0.3.2
@param project The {@link Project} of this {@link Plugin}.
@param configuration The configuration of this {@link Plugin}.
*/
function DefaultPlugin(project, configuration) {
if (configuration == null) {
configuration = {};
}
DefaultPlugin.__super__.constructor.call(this, "kaffee-plugin", project, configuration);
this.register("clean", function() {
var remove, structure;
structure = this.getProject().getConfiguration().getKaffeeConfiguration().getStructure();
this.logger.info("Cleaning project " + (this.getProject().getConfiguration().getName()));
try {
remove = function(path) {
var absolute, file, stats, _i, _len, _ref;
if (!Fs.existsSync(path)) {
return;
}
_ref = Fs.readdirSync(path);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
absolute = Path.join(path, file);
stats = Fs.lstatSync(absolute);
if (stats.isFile()) {
Fs.unlinkSync(absolute);
}
if (stats.isDirectory()) {
remove(absolute);
}
}
return Fs.rmdirSync(path);
};
remove(structure.get("bin"));
return remove(structure.get("bin-test"));
} catch (e) {
return this.logger.error(e);
}
});
}
/*
Loads this plugin.
@since 0.3.0
*/
DefaultPlugin.prototype.load = function() {};
return DefaultPlugin;
})(require("./plugin"));
module.exports = DefaultPlugin;
}).call(this);