From e121efbb1adb5a246146f2101fbc321cab9d58d5 Mon Sep 17 00:00:00 2001 From: Ruslan Zavacky Date: Mon, 9 Oct 2017 13:57:36 +0100 Subject: [PATCH 1/2] Change defaults, so addon is enabled --- config/environment.js | 2 +- index.js | 19 +------------------ tests/dummy/config/environment.js | 5 +++-- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/config/environment.js b/config/environment.js index 8e65cc2..fc7f228 100644 --- a/config/environment.js +++ b/config/environment.js @@ -4,7 +4,7 @@ module.exports = function(/* environment, appConfig */) { return { ifa: { - enabled: false, + enabled: true, inline: false } }; diff --git a/index.js b/index.js index dd7528a..f807e83 100644 --- a/index.js +++ b/index.js @@ -3,18 +3,6 @@ let fs = require('fs'); -const findRoot = (current) => { - let app; - - // Keep iterating upward until we don't have a grandparent. - // Has to do this grandparent check because at some point we hit the project. - do { - app = current.app || app; - } while (current.parent && current.parent.parent && (current = current.parent)); - - return app; -}; - module.exports = { name: 'ember-cli-ifa', @@ -22,16 +10,11 @@ module.exports = { return false; }, - included(app) { - this.app = findRoot(this); - this._super.included.apply(this, arguments); - }, - postBuild(build) { this._super.included.apply(this, arguments); const env = process.env.EMBER_ENV; - const ifaConfig = this.app.project.config(env).ifa; + const ifaConfig = this.project.config(env).ifa; if (!ifaConfig.enabled) { return; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 07bce60..6b73f01 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -22,8 +22,9 @@ module.exports = function(environment) { // when it is created }, ifa: { - enabled: true - } + enabled: true, + inline: false + }, }; if (environment === 'development') { From 3104e3b686e89c003a7c3036a7bb871573753657 Mon Sep 17 00:00:00 2001 From: Ruslan Zavacky Date: Mon, 9 Oct 2017 14:24:55 +0100 Subject: [PATCH 2/2] Don't use '; } }