Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generate command when both usePods option and --pod argument is used #7164

Merged
merged 1 commit into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/commands/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {});
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/pods-generate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down