Skip to content

Commit

Permalink
Merge pull request #1717 from hlindset/fix-blueprint-name-errors
Browse files Browse the repository at this point in the history
Normalize entity name before getting locals
  • Loading branch information
rwjblue committed Aug 24, 2014
2 parents 65a6153 + 6a11a41 commit cf7aab6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# ember-cli Changelog

* [BUGFIX] Call `normalizeEntityName` hook before `locals` hook [#1717](https://github.com/stefanpenner/ember-cli/pull/1717)
* [ENHANCEMENT] replace multiple instances of __name__ in blueprints.
* [ENHANCEMENT] adds http-proxy for explicit, multi proxy use[#1474](https://github.com/stefanpenner/ember-cli/pull/1530)
* [BREAKING ENHANCEMENT] renames apiStub to http-mock to match other http-related generators [#1474] (https://github.com/stefanpenner/ember-cli/pull/1530)
Expand Down
3 changes: 2 additions & 1 deletion lib/models/blueprint.js
Expand Up @@ -215,7 +215,6 @@ Blueprint.prototype.install = function(options) {
var ui = this.ui = options.ui;
var intoDir = options.target;
var dryRun = options.dryRun;
var locals = this._locals(options);
this.project = options.project;
this.testing = options.testing;

Expand Down Expand Up @@ -269,6 +268,8 @@ Blueprint.prototype.install = function(options) {
options.entity.name = this.normalizeEntityName(options.entity.name);
}

var locals = this._locals(options);

return Promise.resolve()
.then(this.beforeInstall.bind(this, options))
.then(this.processFiles.bind(this, intoDir, locals)).map(commit)
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/models/blueprint-test.js
Expand Up @@ -336,6 +336,16 @@ describe('Blueprint', function() {
assert.deepEqual(actualFiles, basicBlueprintFiles);
});
});

it('calls normalizeEntityName before locals hook is called', function(done) {
blueprint.normalizeEntityName = function(){ return 'foo'; };
blueprint.locals = function(options) {
assert.equal(options.entity.name, 'foo');
done();
};
options.entity = { name: 'bar' };
blueprint.install(options);
});
});

describe('addPackageToProject', function() {
Expand Down

0 comments on commit cf7aab6

Please sign in to comment.