* Process the root directory of a project, given a * Project object (we need the object in order to find the internal addons). * _readPackage takes care of the general processing of the root directory * and common locations for addons, filling the cache with each. Once it * returns, we t
(projectInstance)
| 163 | * No copy is made. |
| 164 | */ |
| 165 | loadProject(projectInstance) { |
| 166 | logger.info('Loading project at %o...', projectInstance.root); |
| 167 | |
| 168 | let pkgInfo = this._readPackage(projectInstance.root, projectInstance.pkg, true); |
| 169 | |
| 170 | // NOTE: the returned val may contain errors, or may contain |
| 171 | // other packages that have errors. We will try to process |
| 172 | // things anyway. |
| 173 | if (!pkgInfo.processed) { |
| 174 | this.projects.push(projectInstance); |
| 175 | |
| 176 | // projects are a bit different than standard addons, in that they have |
| 177 | // possibly a CLI addon and internal addons. Add those now. |
| 178 | pkgInfo.project = projectInstance; |
| 179 | |
| 180 | if (projectInstance.cli && projectInstance.cli.root) { |
| 181 | logger.info('Reading package for "ember-cli": %o', projectInstance.cli.root); |
| 182 | pkgInfo.cliInfo = this._readPackage(projectInstance.cli.root); |
| 183 | } |
| 184 | |
| 185 | // add any internal addons in the project. Since internal addons are |
| 186 | // optional (and only used some of the time anyway), we don't want to |
| 187 | // create a PackageInfo unless there is really a directory at the |
| 188 | // suggested location. The created addon may internally have errors, |
| 189 | // as with any other PackageInfo. |
| 190 | projectInstance.supportedInternalAddonPaths().forEach((internalAddonPath) => { |
| 191 | if (getRealDirectoryPath(internalAddonPath)) { |
| 192 | logger.info('Reading package for internal addon: %o', internalAddonPath); |
| 193 | pkgInfo.addInternalAddon(this._readPackage(internalAddonPath)); |
| 194 | } |
| 195 | }); |
| 196 | |
| 197 | this._resolveDependencies(); |
| 198 | } |
| 199 | |
| 200 | return pkgInfo; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * To support the project.reloadPkg method, we need the ability to flush |
no test coverage detected