Skip to content

Commit

Permalink
Merge pull request #3622 from johanneswuerbach/init-in-addon
Browse files Browse the repository at this point in the history
[BUGFIX] Fix ember init inside an existing addon
  • Loading branch information
rwjblue committed Mar 24, 2015
2 parents 108a273 + b8a62c2 commit b0f0aed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion blueprints/addon/index.js
Expand Up @@ -130,7 +130,7 @@ module.exports = {
normalizeEntityName: function(entityName) {
entityName = Blueprint.prototype.normalizeEntityName.apply(this, arguments);

if(this.project.isEmberCLIProject()) {
if(this.project.isEmberCLIProject() && !this.project.isEmberCLIAddon()) {
throw new SilentError('Generating an addon in an existing ember-cli project is not supported.');
}

Expand Down
11 changes: 11 additions & 0 deletions tests/unit/blueprints/addon-test.js
Expand Up @@ -27,6 +27,17 @@ describe('blueprint - addon', function(){
}).to.throw('Generating an addon in an existing ember-cli project is not supported.');
});

it('works when current project is an existing ember-cli addon', function(){
mockProject.isEmberCLIAddon = function() { return true; };
var blueprint = Blueprint.lookup('addon');

blueprint.project = mockProject;

expect(function() {
blueprint.normalizeEntityName('foo');
}).not.to.throw('Generating an addon in an existing ember-cli project is not supported.');
});

it('keeps existing behavior by calling Blueprint.normalizeEntityName', function(){
var blueprint = Blueprint.lookup('addon');

Expand Down

0 comments on commit b0f0aed

Please sign in to comment.