shipshapecode / ember-cli-release

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

Add `preventRelease` hook. #30

Closed rwjblue closed 8 years ago

rwjblue commented 8 years ago

There have been a number of times that I have wanted a hook in config/release.js that is called with the same arguments as beforeCommit and afterPush which allows me to prevent any modifications. This would be done just after step 3.

A few scenarios where this would be helpful:

My thought was that if we added a preventRelease hook you could return true to prevent modifications. Something like:

module.exports = {
  preventRelease: function(project, versions) {
    // do something here to detect stuff
    if (tharBeDragons) {
      return true;
    }
  }
};

I am not very tied to the name preventRelease (open to better suggestions).

slindberg commented 8 years ago

It seems to me like we're just missing a hook that runs after the tag is calculated but before anything filesystem changes. I'm in favor of creating a new hook whose name is descriptive of when in the workflow it runs; preventRelease implies to me that it is executed before pushing things, not before anything really happens.

Throwing from a hook already aborts the release and prints the error message (although maybe it could be wrapped in SilentError for better formatting). If the name doesn't imply that its sole purpose is for aborting, throwing an error is a natural way to prevent anything else from happening.

What about beforeReplace? I'm also having trouble coming up with a decent name.