MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / constructor

Method constructor

lib/models/project.js:41–105  ·  view source on GitHub ↗

The Project model is tied to your package.json. It is instantiated by giving {{#crossLink "Project/closestSync:method"}}{{/crossLink}} the path to your project. @class Project @constructor @param {String} root Root directory for the project @param {Object} pkg Contents of p

(root, pkg, ui, cli)

Source from the content-addressed store, hash-verified

39 @param {CLI} cli
40 */
41 constructor(root, pkg, ui, cli) {
42 logger.info('init root: %s', root);
43
44 this.root = root;
45 this.pkg = pkg;
46 this.ui = ui;
47 this.cli = cli;
48 this.addonPackages = Object.create(null);
49 this.addons = [];
50 this.liveReloadFilterPatterns = [];
51 this.configCache = new Map();
52 this.hostInfoCache = new HostInfoCache(this);
53
54 /**
55 Set when the `Watcher.detectWatchman` helper method finishes running,
56 so that other areas of the system can be aware that watchman is being used.
57
58 For example, this information is used in the broccoli build pipeline to know
59 if we can watch additional directories "cheaply".
60
61 Contains `enabled` and `version`.
62
63 @private
64 @property _watchmanInfo
65 @return {Object}
66 @default false
67 */
68 this._watchmanInfo = {
69 enabled: false,
70 version: null,
71 canNestRoots: false,
72 };
73
74 let instrumentation = (this._instrumentation = ensureInstrumentation(cli, ui));
75 instrumentation.project = this;
76
77 this.emberCLIVersion = emberCLIVersion;
78
79 this._nodeModulesPath = null;
80
81 if (this.cli && this.cli.packageInfoCache) {
82 this.packageInfoCache = this.cli.packageInfoCache;
83 } else {
84 this.packageInfoCache = new PackageInfoCache(this.ui);
85 }
86
87 // we're not dealing with NULL_PROJECT (note that it has not
88 // be set yet, so we can't compare to that var.)
89 this._packageInfo = this.packageInfoCache.loadProject(this);
90
91 // force us to use the real path as the root.
92 this.root = this._packageInfo.realPath;
93
94 // XXX Need to decide what to do here about showing errors. For
95 // a non-CLI project the cache is local and probably should. For
96 // a CLI project the cache is there, but not sure when we'll know
97 // about all the errors, because there may be multiple projects.
98 if (this.packageInfoCache.hasErrors()) {

Callers

nothing calls this directly

Calls 6

ensureInstrumentationFunction · 0.85
createMethod · 0.80
loadProjectMethod · 0.80
showErrorsMethod · 0.80
isEnabledMethod · 0.80
hasErrorsMethod · 0.45

Tested by

no test coverage detected