Repository: ember-cli/ember-cli
Pull request #7164 (2017-06-29 12:59:35)

Fix generate command when both usePods option and --pod argument is used
Resolves https://github.com/ember-cli/ember-cli/issues/7163 

rwjblue: I agree that this is confusing, but the intent here was fhT --pod flag negates the value of usePods. So if you had usePods as true you would use --pod to get non-pods. 
emrekutlu: Hmm, so what does <code>--classic</code> do?
rwjblue: @Turbo87 - This patch has nothing to do with using both `--pod` and `--classic` at the same time, what am I missing?
hjdivad: > @Turbo87 - This patch has nothing to do with using both --pod and --classic at the same time, what am I missing?

I think the point is that the existence of `--classic` implies the semantics of `--pod` is `--use-pods` and not `--toggle-pods` and not (only) that they're confusing when used together
rwjblue: I totally agree with you there, but this change would be a breaking change for anyone leveraging the existing behavior. 

I'd be totally fine with adding a deprecation / warning for anyone that has both `usePods` and specifies either `--pods` or `--classic` specified, but not with arbitrarily changing the meaning of the flags (at least not within the same release, but it could be feathered out)...
Turbo87: @emrekutlu can you prepare a PR that prints a warning to the console when `--pod` is used in combination with `usePods`?
rwjblue: @emrekutlu - Ping?
emrekutlu: @rwjblue sorry for the wait, I am going to update the pull request this week hopefully. Thanks for pinging.

Patch:
diff --git a/lib/commands/generate.js b/lib/commands/generate.js
index 73606d56a..08a5b1797 100644
--- a/lib/commands/generate.js
+++ b/lib/commands/generate.js
@@ -43,8 +43,16 @@ module.exports = Command.extend({
       args: rawArgs,
     };
 
-    if (this.settings && this.settings.usePods && !commandOptions.classic) {
-      commandOptions.pod = !commandOptions.pod;
+    if (this.settings && this.settings.usePods) {
+      if (commandOptions.pod) {
+        let warning = 'Using both .ember-cli usePods settings and --pod flag ';
+        warning += 'together has been deprecated.';
+        this.ui.writeDeprecateLine(warning);
+      }
+
+      if (!commandOptions.classic) {
+        commandOptions.pod = !commandOptions.pod;
+      }
     }
 
     let taskOptions = _.merge(taskArgs, commandOptions || {});


Test patch:
diff --git a/tests/acceptance/pods-generate-test.js b/tests/acceptance/pods-generate-test.js
index c50520a22..cc152cc01 100644
--- a/tests/acceptance/pods-generate-test.js
+++ b/tests/acceptance/pods-generate-test.js
@@ -104,6 +104,13 @@ describe('Acceptance: ember generate pod', function() {
       .to.contain("moduleFor('controller:foo'");
   }));
 
+  it('will show a deprecation warning when both .ember-cli usePods settings and --pod flag are used together', co.wrap(function *() {
+    let result = yield generateWithUsePods(['controller', 'foo', '--pod']);
+
+    expect(result.outputStream.join()).to.include('Using both .ember-cli usePods settings and --pod flag ' +
+      'together has been deprecated.');
+  }));
+
   it('.ember-cli usePods setting generates in classic structure with --classic flag', co.wrap(function *() {
     yield generateWithUsePods(['controller', 'foo', '--classic']);