diff --git a/index.js b/index.js index 95a02edb..859915f6 100644 --- a/index.js +++ b/index.js @@ -61,6 +61,19 @@ module.exports = { return new BroccoliMergeTrees([tree, instrumentedNode], { overwrite: true }); }, + setupPreprocessorRegistry: function() { + var codeCoverageAddon = this; + function iterateAddons(addons) { + addons.forEach(function(addon) { + if (addon.isDevelopingAddon && addon.isDevelopingAddon()) { + addon.addons.push(codeCoverageAddon); + } + iterateAddons(addon.addons); + }); + } + iterateAddons(this.project.addons); + }, + includedCommands: function () { return { 'coverage-merge': require('./lib/coverage-merge') @@ -143,6 +156,22 @@ module.exports = { return this._doesTemplateFileExist(relativePath); }, + /** + * Check if a file exists within an in-repo addon + * @param {String} relativePath - path to file + * @returns {Boolean} whether or not the file exists within an in-app addon + */ + _doesFileExistInCurrentProjectInRepoAddons: function(relativePath) { + relativePath = relativePath.split('/').splice(1, 0, 'addon').join('/'); + relativePath = path.join('lib', relativePath); + + if (this._existsSync(relativePath)) { + return true; + } + + return this._doesTemplateFileExist(relativePath); + }, + /** * Check if a template file exists within the current app/addon * Note: Template files are already compiled into JavaScript files so we must @@ -193,7 +222,8 @@ module.exports = { this._doesFileExistInDummyApp(relativePath) || this._doesFileExistInCurrentProjectApp(relativePath) || this._doesFileExistInCurrentProjectAddon(relativePath) || - this._doesFileExistInCurrentProjectAddonModule(relativePath) + this._doesFileExistInCurrentProjectAddonModule(relativePath) || + this._doesFileExistInCurrentProjectInRepoAddons(relativePath) ); return !fileExists;