mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
2777093c76
- no more need to explictly add a model file to be loaded! - this makes building Ghost just the tiniest smidge easier
31 lines
512 B
JavaScript
31 lines
512 B
JavaScript
/**
|
|
* Dependencies
|
|
*/
|
|
|
|
const _ = require('lodash');
|
|
const glob = require('glob');
|
|
|
|
// 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;
|