Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add a PreviousVersionProvider role #37

Open
wants to merge 1 commit into from

5 participants

@yanick

Right now, plugins implementing the VersionProvider role
are doing up to two different tasks: retrieving the previous
version number, and incrementing it according to a given scheme.
The goal of the PreviousVersionProvider role is to split those
tasks between the two roles.

Of course, I'm not submitting the patch without having some secret
agenda: I seek this new role as a way to cleanly split the semantic
versioning scheme and the Git component that I'm using in
http://babyl.dyndns.org/techblog/entry/dist-zilla-semanticversion

@yanick yanick add a PreviousVersionProvider role
Right now, plugins implementing the VersionProvider role
are doing up to two different tasks: retrieving the previous
version number, and incrementing it according to a given scheme.
The goal of the PreviousVersionProvider role is to split those
tasks between the two roles.

Of course, I'm not submitting the patch without having some secret
agenda: I seek this new role as a way to cleanly split the semantic
versioning scheme and the Git component that I'm using in
http://babyl.dyndns.org/techblog/entry/dist-zilla-semanticversion
55cde29
@doherty

AHA! I couldn't remember who had been working on a semantic versioning plugin...

Well, if this is added, please remind me that I promised to help you with this. I intend to do so, but it looks a bit stalled for now.

@yanick

Yup, t'was me. :-)

Although this patch is in limbo, we can still go on with the work on the plugins themselves. What needs to be done, basically, is to take the code in Dist::Zilla::Plugin::Author::YANICK::NextSemanticVersion.pm and split it in Dist::Zilla::Plugin::PreviousVersion::Git and Dist::Zilla::Plugin::NextVersion::Semantic (or any other namespace that makes more sense). The work should be straightforward -- one just need the tuits to do it. :-)

@madsen

I'll just point out that since you're simply adding a new module, and not altering any core dzil code, there's no reason you need to get this merged into the dzil core. Just close this pull request, release Dist::Zilla::Role::PreviousVersionProvider on CPAN, and have at it. You should probably have another role for plugins that want to get the previous version (Dist::Zilla::Role::UsePreviousVersionProvider?) that provides a method that takes care of calling the plugin(s) that do PreviousVersionProvider and returning the previous version.

@yanick

I'll prolly end up doing just that. It's just that it's such a teeny little piece of code that it feels overkill to release it on its own. Ah well, we'll see next time I have time to return to my dist::zilla stuff.

Thanks for the comment! :-)

@madsen

BTW, on second thought, Dist::Zilla::Role::PreviousVersionUser is probably a better name for the role that finds & runs the PreviousVersionProvider plugin(s).

@karenetheridge

where's this at now? It sounds promising.

@karenetheridge

::PreviousVersionProviderUser -- which just does $zilla->plugins_with(-PreviousVersionProvider).

@rjbs
Owner

Is this still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 11, 2011
  1. @yanick

    add a PreviousVersionProvider role

    yanick authored
    Right now, plugins implementing the VersionProvider role
    are doing up to two different tasks: retrieving the previous
    version number, and incrementing it according to a given scheme.
    The goal of the PreviousVersionProvider role is to split those
    tasks between the two roles.
    
    Of course, I'm not submitting the patch without having some secret
    agenda: I seek this new role as a way to cleanly split the semantic
    versioning scheme and the Git component that I'm using in
    http://babyl.dyndns.org/techblog/entry/dist-zilla-semanticversion
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/Dist/Zilla/Role/PreviousVersionProvider.pm
View
19 lib/Dist/Zilla/Role/PreviousVersionProvider.pm
@@ -0,0 +1,19 @@
+package Dist::Zilla::Role::PreviousVersionProvider;
+# ABSTRACT: something that provides the dist's previous version number
+use Moose::Role;
+with 'Dist::Zilla::Role::Plugin';
+
+=head1 DESCRIPTION
+
+Plugins implementing this role must provide a C<previous_version>
+method that might be called when another (or the same) plugin implementing
+the C<VersionProvider> role will set the dist's version.
+
+If no previous version exists, the plugin is expected to return C<undef>.
+
+=cut
+
+requires 'previous_version';
+
+no Moose::Role;
+1;
Something went wrong with that request. Please try again.