2017-03-29 15:37:30 +00:00
|
|
|
let async = require('async');
|
2018-04-25 14:34:17 +00:00
|
|
|
const constants = require('./constants');
|
2017-03-01 04:29:16 +00:00
|
|
|
|
2017-12-05 23:14:46 +00:00
|
|
|
require('colors');
|
2016-08-14 12:04:34 +00:00
|
|
|
|
2018-08-15 15:42:28 +00:00
|
|
|
// Set PWD to CWD since Windows doesn't have a value for PWD
|
|
|
|
if (!process.env.PWD) {
|
|
|
|
process.env.PWD = process.cwd();
|
|
|
|
}
|
2018-04-09 20:14:07 +00:00
|
|
|
|
2017-03-30 13:16:46 +00:00
|
|
|
let version = require('../package.json').version;
|
|
|
|
|
2017-03-31 11:34:43 +00:00
|
|
|
class Embark {
|
2017-03-30 13:16:46 +00:00
|
|
|
|
2018-06-19 14:03:46 +00:00
|
|
|
constructor(options) {
|
2017-03-30 13:16:46 +00:00
|
|
|
this.version = version;
|
|
|
|
this.options = options || {};
|
|
|
|
}
|
2017-03-30 11:12:39 +00:00
|
|
|
|
2017-03-30 13:16:46 +00:00
|
|
|
initConfig(env, options) {
|
|
|
|
let Events = require('./core/events.js');
|
|
|
|
let Logger = require('./core/logger.js');
|
|
|
|
let Config = require('./core/config.js');
|
2017-03-30 11:12:39 +00:00
|
|
|
|
2017-03-30 13:16:46 +00:00
|
|
|
this.events = new Events();
|
2018-03-15 21:18:20 +00:00
|
|
|
this.logger = new Logger({logLevel: 'debug', events: this.events});
|
2017-03-30 13:16:46 +00:00
|
|
|
|
2018-04-25 14:34:17 +00:00
|
|
|
this.config = new Config({env: env, logger: this.logger, events: this.events, context: this.context});
|
2017-03-30 11:12:39 +00:00
|
|
|
this.config.loadConfigFiles(options);
|
|
|
|
this.plugins = this.config.plugins;
|
2017-03-30 13:16:46 +00:00
|
|
|
}
|
2017-03-30 11:12:39 +00:00
|
|
|
|
2017-03-30 13:16:46 +00:00
|
|
|
}
|
2017-03-12 02:49:12 +00:00
|
|
|
|
2016-08-18 00:29:41 +00:00
|
|
|
module.exports = Embark;
|