Skip to content

Commit

Permalink
Re-order postBuild hook
Browse files Browse the repository at this point in the history
Currently the postbuild is not very useful as it is called after everything is already in dist. The `results.directory` folder points to a directory that is going to get cleaned up soon after. This allows you to write to the final tree right before it is copied to dist.
  • Loading branch information
chadhietala committed May 6, 2015
1 parent b878608 commit 1ef8617
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/models/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ module.exports = Task.extend({
.then(function() {
return self.builder.build.apply(self.builder, args);
})
.then(this.processBuildResult.bind(this))
.then(this.processAddonBuildSteps.bind(this, 'postBuild'))
.then(this.processBuildResult.bind(this))
.catch(function(error) {

this.processAddonBuildSteps('buildError', error);
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/models/builder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@ describe('models/builder.js', function() {
});
});

it('should call postBuild before processBuildResult', function() {
var called = [];

addon.postBuild = function() {
called.push('postBuild');
};

builder.processBuildResult = function() {
called.push('processBuildResult');
};

return builder.build().then(function() {
expect(called).to.deep.equal(['postBuild', 'processBuildResult']);
});
});

it('buildError receives the error object from the errored step', function() {
var thrownBuildError = new Error('buildError');
var receivedBuildError;
Expand Down

0 comments on commit 1ef8617

Please sign in to comment.