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

[BUGFIX] Fix ember init inside an existing addon #3622

Merged
merged 1 commit into from Mar 24, 2015
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
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