Skip to content

Commit

Permalink
Merge pull request #16293 from jamescdavis/ignore-pod-for-addon-helpe…
Browse files Browse the repository at this point in the history
…r-initializer-instance-initializer

[BUGFIX release] Ignore --pod for -addon blueprints: helper, initializer, and instance-initializer
  • Loading branch information
rwjblue authored Mar 20, 2018
2 parents 4fe25d0 + 14d5bb0 commit 87f43e4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
10 changes: 0 additions & 10 deletions blueprints/-addon-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ module.exports = {
fileMapTokens: function() {
return {
__name__: function(options) {
if (options.pod && options.hasPathToken) {
return options.locals.blueprintName;
}
return options.dasherizedModuleName;
},
__path__: function(options) {
if (options.pod && options.hasPathToken) {
return path.join(options.podPath, options.dasherizedModuleName);
}
return inflector.pluralize(options.locals.blueprintName);
},
__root__: function(options) {
Expand All @@ -42,10 +36,6 @@ module.exports = {
modulePathSegments = [addonName, inflector.pluralize(blueprintName), fileName];
}

if (options.pod) {
modulePathSegments = [addonName, fileName, blueprintName];
}

return {
modulePath: modulePathSegments.join('/'),
blueprintName: blueprintName
Expand Down
7 changes: 7 additions & 0 deletions node-tests/blueprints/helper-addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ describe('Blueprint: helper-addon', function() {
.to.equal(fixture('helper-addon.js'));
});
});

it('helper-addon foo/bar-baz --pod', function() {
return emberGenerateDestroy(['helper-addon', 'foo/bar-baz', '--pod'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
.to.equal(fixture('helper-addon.js'));
});
});
});
});
7 changes: 7 additions & 0 deletions node-tests/blueprints/initializer-addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ describe('Blueprint: initializer-addon', function() {
.to.contain("export { default, initialize } from 'my-addon/initializers/foo';");
});
});

it('initializer-addon foo --pod', function() {
return emberGenerateDestroy(['initializer-addon', 'foo', '--pod'], _file => {
expect(_file('app/initializers/foo.js'))
.to.contain("export { default, initialize } from 'my-addon/initializers/foo';");
});
});
});
});
7 changes: 7 additions & 0 deletions node-tests/blueprints/instance-initializer-addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ describe('Blueprint: instance-initializer-addon', function() {
.to.contain("export { default, initialize } from 'my-addon/instance-initializers/foo';");
});
});

it('instance-initializer-addon foo --pod', function() {
return emberGenerateDestroy(['instance-initializer-addon', 'foo', '--pod'], _file => {
expect(_file('app/instance-initializers/foo.js'))
.to.contain("export { default, initialize } from 'my-addon/instance-initializers/foo';");
});
});
});
});

0 comments on commit 87f43e4

Please sign in to comment.