From cdde6cd9520875f2f472340e7467be1e3dec395a Mon Sep 17 00:00:00 2001 From: burn Date: Tue, 4 Apr 2017 13:58:07 +0300 Subject: [PATCH 1/2] Check for Ember version with new ember-cli-version-checker API. Remove unused treeForAddonTemplates method --- index.js | 24 ++++++------------------ package.json | 2 +- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/index.js b/index.js index 2ca61fcf..acbedb71 100644 --- a/index.js +++ b/index.js @@ -11,25 +11,13 @@ module.exports = { init: function() { this._super.init && this._super.init.apply(this, arguments); var checker = new VersionChecker(this); - if (!checker.for('ember-cli', 'npm').isAbove('0.2.6')) { - console.warn("Warning: ember-modal-dialog requires ember-cli >= 0.2.6 " - + "for support for the addon-templates tree, which allows " - + "us to support various ember versions. Use an older " - + "version of ember-modal-dialog if you are stuck on an " - + "older ember-cli."); - } - }, - - treeForAddonTemplates: function treeForAddonTemplates (tree) { - var checker = new VersionChecker(this); - var dep = checker.for('ember', 'bower'); - - var baseTemplatesPath = path.join(this.root, 'addon/templates'); - if (dep.lt('1.13.0-beta.1')) { - return this.treeGenerator(path.join(baseTemplatesPath, 'lt-1-13')); - } else { - return this.treeGenerator(path.join(baseTemplatesPath, 'current')); + if (!checker.forEmber().isAbove('0.2.6')) { + console.warn("Warning: ember-modal-dialog requires ember-cli >= 0.2.6 " + + "for support for the addon-templates tree, which allows " + + "us to support various ember versions. Use an older " + + "version of ember-modal-dialog if you are stuck on an " + + "older ember-cli."); } } }; diff --git a/package.json b/package.json index ce77067d..f4f1205d 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "dependencies": { "ember-cli-babel": "^5.1.6", "ember-cli-htmlbars": "^1.0.8", - "ember-cli-version-checker": "^1.1.6", + "ember-cli-version-checker": "^1.2.0", "ember-wormhole": "~0.3.6" }, "keywords": [ From 162e63d24271628d7ffdd60ca5e43aed1d4180f2 Mon Sep 17 00:00:00 2001 From: burn Date: Tue, 4 Apr 2017 16:54:02 +0300 Subject: [PATCH 2/2] Took back treeForAddonTemplates method --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index acbedb71..74301020 100644 --- a/index.js +++ b/index.js @@ -19,5 +19,18 @@ module.exports = { + "version of ember-modal-dialog if you are stuck on an " + "older ember-cli."); } + }, + + treeForAddonTemplates: function treeForAddonTemplates (tree) { + var checker = new VersionChecker(this); + var emberVersion = checker.forEmber(); + + var baseTemplatesPath = path.join(this.root, 'addon/templates'); + + if (emberVersion.lt('1.13.0-beta.1')) { + return this.treeGenerator(path.join(baseTemplatesPath, 'lt-1-13')); + } else { + return this.treeGenerator(path.join(baseTemplatesPath, 'current')); + } } };