shipshapecode / ember-cli-release

Ember CLI addon for versioned release management
MIT License
90 stars 18 forks source link

Add support for specifying a `beforeCommit` hook. #12

Closed lukemelia closed 9 years ago

lukemelia commented 9 years ago

If you supply a function as the beforeCommit property in your config/release.js, it will be invoked with a reference to the project and the versions object. The purpose of the hook is to allow a project to do any other updates to files that may need to be updated to the current version.

e.g.

// config/release.js
var path = require('path');
var xmlpoke = require('xmlpoke');

module.exports = {
 beforeCommit: function(project, versions){
   xmlpoke(path.join(project.root, 'cordova/config.xml'), function(xml) {
     xml.addNamespace('w', 'http://www.w3.org/ns/widgets');
     xml.set('w:widget/@version', versions.next);
   });
 }
}
chrislopresto commented 9 years ago

This is in pretty good shape. Ready for review.

rwjblue commented 9 years ago

This looks good to me. I'm :+1:.

@slindberg - Thoughts?

slindberg commented 9 years ago

This looks fantastic :+1:

Definitely like the beforeHook/afterHook naming. Thinking about it a little more, the afterCommit/beforeTag and afterTag/beforePush hooks are redundant, but it seems fine if they run in sequence just for clarity's sake. Thoughts?

lukemelia commented 9 years ago

Yeah, I think before/after each of those steps probably makes sense even though some will run back-to-back.

slindberg commented 9 years ago

It looks like config value type mismatches are not fatal when loaded by ember-cli, but no coercion happens. I'll follow up with a quick PR to do some validation.

Thanks for all the hard work @lukemelia!

lukemelia commented 9 years ago

Thanks @slindberg. Props go to @chrislopresto on this too, who paired with me on it yesterday.

rwjblue commented 9 years ago

Very excited about this, thank you!