art-config
Version:
A powerful yet simple tool for configuring all your libraries consistently.
58 lines (42 loc) • 2.07 kB
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
var BaseObject, ConfigRegistry, Configuration, deepMerge, defineModule, log, merge, mergeInto, ref,
extend = 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; },
hasProp = {}.hasOwnProperty;
ref = require('art-standard-lib'), defineModule = ref.defineModule, log = ref.log, merge = ref.merge, mergeInto = ref.mergeInto, deepMerge = ref.deepMerge;
BaseObject = require('art-class-system').BaseObject;
ConfigRegistry = require('./ConfigRegistry');
defineModule(module, Configuration = (function(superClass) {
extend(Configuration, superClass);
function Configuration() {
return Configuration.__super__.constructor.apply(this, arguments);
}
Configuration.abstractClass();
Configuration.register = function() {
return ConfigRegistry.registerConfig(this.getName(), this.getProps());
};
Configuration.postCreateConcreteClass = function(arg) {
var hotReloaded, superclass;
hotReloaded = arg.hotReloaded;
if (superclass = this.getSuperclass()) {
this.deepMergeInDefaults(superclass.getConcretePrototypeProperties());
}
this.register();
if (hotReloaded) {
ConfigRegistry.reload();
}
return Configuration.__super__.constructor.postCreateConcreteClass.apply(this, arguments);
};
Configuration.getProps = function() {
return this.getConcretePrototypeProperties();
};
Configuration.deepMergeInDefaults = function(defaults) {
return mergeInto(this.prototype, deepMerge(defaults, this.getProps()));
};
Configuration.deepMergeInConfig = function(config) {
return mergeInto(this.prototype, deepMerge(this.getProps(), config));
};
return Configuration;
})(BaseObject));
}).call(this);
//# sourceMappingURL=Configuration.js.map