Ghost/core/server/models/index.js

31 lines
512 B
JavaScript
Raw Normal View History

/**
* Dependencies
*/
const _ = require('lodash');
const glob = require('glob');
2013-06-01 18:47:41 +04:00
// enable event listeners
require('./base/listeners');
/**
* Expose all models
*/
exports = module.exports;
function init() {
exports.Base = require('./base');
let modelsFiles = glob.sync('!(index).js', {cwd: __dirname});
modelsFiles.forEach((model) => {
const name = model.replace(/.js$/, '');
_.extend(exports, require('./' + name));
});
}
/**
* Expose `init`
*/
exports.init = init;