greppy.js
* @author Hermann Mayer <hermann.mayer92@gmail.com>
var cluster = require('cluster');
var colors = require('colors');
var winston = require('winston');
var moment = require('moment');
var es5 = require('es5-shim');
var es6 = require('es6-shim');
// Annotate this as the super global "greppy"
// Set environment if not given
greppy.env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
// First of all, load the data-types extensions
var extensionPath = __dirname + '/extension/datatype/';
fs.readdirSync(extensionPath).forEach(function(extension) {
if (!extension.match(/\.js$/i)) {
require(extensionPath + extension);
// Register all sub-super globals
this.config = new (this.get('store.config'))();
this.helper = new (this.get('store.helper'))();
this.db = new (this.get('store.db'))();
// Load all helpers of the application
this.helper.loadApplicationHelpers();
* Setup an default logger. This is adds the ability to
* easily use the Greppy Framework parts without an Greppy
Greppy.prototype.initDefaultLogger = function()
this.logger = new winston.Logger({
new (winston.transports.Console)({
return moment().format().yellow.bold;
greppy.logger = global.logger = this.logger;
* @param {String} classPath - Dot seperated class path
Greppy.prototype.get = function(classPath)
var path = __dirname + '/' + classPath.split('.').join('/');
'Cannot load class "' + classPath + '" (' + path + ').'