Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rjbs/Dist-Zilla
...
head fork: rjbs/Dist-Zilla
  • 7 commits
  • 27 files changed
  • 0 commit comments
  • 3 contributors
Commits on Jun 02, 2012
@karenetheridge karenetheridge Support -TRIAL in versions for [NextRelease]
Adopted the same syntax as from various Git plugins (e.g. [Git::Commit],
except %t was already being used for tab, so switched to %T. ([Git] should
probably adopt %T, as %t for tab is pretty standard.)
Also added %V to allow justification on the combined version-TRIAL string,
although I suspect that String::Formatter can handle this in a better way.
2743be0
@madsen madsen Add %E & %U format codes to NextRelease
  Add user_stash attribute
  Clean up documentation
08f15a4
@madsen madsen Fix nextrelease.t to use Test::Fatal
  Otherwise, the test is quietly skipped instead of failing
59f6793
@madsen madsen Test %E & %U format codes in NextRelease d690615
@madsen madsen Remove __END__ markers
  Pod::Weaver likes to insert those itself.  Otherwise, the POD will be
  placed before the __END__ marker.
9927c73
@madsen madsen Mention OurPkgVersion in PkgVersion ee00e4b
Commits on Jun 08, 2012
@rjbs v4.300018
          format codes %E, %T, %U, & %V added to NextRelease (thanks,
          Karen Etheridge & Christopher J. Madsen!)
bb25f5c
Showing with 224 additions and 48 deletions.
  1. +4 −0 Changes
  2. +0 −1  lib/Dist/Zilla.pm
  3. +0 −1  lib/Dist/Zilla/Plugin/AutoPrereq.pm
  4. +0 −1  lib/Dist/Zilla/Plugin/AutoVersion.pm
  5. +0 −2  lib/Dist/Zilla/Plugin/ConfirmRelease.pm
  6. +0 −2  lib/Dist/Zilla/Plugin/FakeRelease.pm
  7. +0 −2  lib/Dist/Zilla/Plugin/FileFinder/ByName.pm
  8. +0 −2  lib/Dist/Zilla/Plugin/FileFinder/Filter.pm
  9. +0 −1  lib/Dist/Zilla/Plugin/InlineFiles.pm
  10. +0 −1  lib/Dist/Zilla/Plugin/License.pm
  11. +0 −1  lib/Dist/Zilla/Plugin/MakeMaker.pm
  12. +0 −1  lib/Dist/Zilla/Plugin/MetaConfig.pm
  13. +0 −1  lib/Dist/Zilla/Plugin/MetaJSON.pm
  14. +1 −2  lib/Dist/Zilla/Plugin/MetaNoIndex.pm
  15. +0 −1  lib/Dist/Zilla/Plugin/MetaResources.pm
  16. +0 −1  lib/Dist/Zilla/Plugin/MetaYAML.pm
  17. +0 −1  lib/Dist/Zilla/Plugin/ModuleBuild.pm
  18. +71 −8 lib/Dist/Zilla/Plugin/NextRelease.pm
  19. +4 −1 lib/Dist/Zilla/Plugin/PkgVersion.pm
  20. +0 −1  lib/Dist/Zilla/Plugin/PodVersion.pm
  21. +0 −1  lib/Dist/Zilla/Plugin/Prereqs.pm
  22. +0 −1  lib/Dist/Zilla/Plugin/PruneFiles.pm
  23. +0 −1  lib/Dist/Zilla/PluginBundle/Basic.pm
  24. +0 −1  lib/Dist/Zilla/PluginBundle/Classic.pm
  25. +0 −1  lib/Dist/Zilla/Role/VersionProvider.pm
  26. +0 −1  lib/Dist/Zilla/Tutorial.pm
  27. +144 −11 t/plugins/nextrelease.t
View
4 Changes
@@ -2,6 +2,10 @@ Revision history for {{$dist->name}}
{{$NEXT}}
+4.300018 2012-06-07 22:25:03 America/New_York
+ format codes %E, %T, %U, & %V added to NextRelease (thanks,
+ Karen Etheridge & Christopher J. Madsen!)
+
4.300017 2012-05-31 12:17:45 America/New_York
also check plugin version requirements in dzil authordeps --missing
(Karen Etheridge)
View
1  lib/Dist/Zilla.pm
@@ -674,7 +674,6 @@ sub stash_named {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SUPPORT
View
1  lib/Dist/Zilla/Plugin/AutoPrereq.pm
@@ -14,7 +14,6 @@ before register_component => sub {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/AutoVersion.pm
@@ -85,7 +85,6 @@ sub provide_version {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
2  lib/Dist/Zilla/Plugin/ConfirmRelease.pm
@@ -33,8 +33,6 @@ sub before_release {
__PACKAGE__->meta->make_immutable;
1;
-__END__
-
=head1 DESCRIPTION
This plugin prompts the author whether or not to continue before releasing
View
2  lib/Dist/Zilla/Plugin/FakeRelease.pm
@@ -29,8 +29,6 @@ sub release {
__PACKAGE__->meta->make_immutable;
1;
-__END__
-
=head1 SYNOPSIS
[FakeRelease]
View
2  lib/Dist/Zilla/Plugin/FileFinder/ByName.pm
@@ -135,8 +135,6 @@ sub find_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
-
=head1 DESCRIPTION
FileFinder::ByName is a L<FileFinder|Dist::Zilla::Role::FileFinder> that
View
2  lib/Dist/Zilla/Plugin/FileFinder/Filter.pm
@@ -76,8 +76,6 @@ sub find_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
-
=head1 DESCRIPTION
FileFinder::Filter is a L<FileFinder|Dist::Zilla::Role::FileFinder> that
View
1  lib/Dist/Zilla/Plugin/InlineFiles.pm
@@ -40,7 +40,6 @@ sub gather_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/License.pm
@@ -29,7 +29,6 @@ sub gather_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/MakeMaker.pm
@@ -263,7 +263,6 @@ has __write_makefile_args => (
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/MetaConfig.pm
@@ -47,7 +47,6 @@ sub metadata {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/MetaJSON.pm
@@ -80,7 +80,6 @@ sub gather_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
3  lib/Dist/Zilla/Plugin/MetaNoIndex.pm
@@ -44,7 +44,7 @@ my %ATTR_ALIAS = (
sub mvp_aliases {
my %alias_for;
-
+
for my $key (keys %ATTR_ALIAS) {
$alias_for{ $_ } = $key for @{ $ATTR_ALIAS{$key} };
}
@@ -112,7 +112,6 @@ sub metadata {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/MetaResources.pm
@@ -65,7 +65,6 @@ sub metadata {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/MetaYAML.pm
@@ -82,7 +82,6 @@ sub gather_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/ModuleBuild.pm
@@ -168,7 +168,6 @@ has __module_build_args => (
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
79 lib/Dist/Zilla/Plugin/NextRelease.pm
@@ -11,6 +11,7 @@ with (
);
use DateTime 0.44; # CLDR fixes
+use Moose::Util::TypeConstraints;
use String::Formatter 0.100680 stringf => {
-as => '_format_version',
@@ -24,6 +25,13 @@ use String::Formatter 0.100680 stringf => {
},
t => sub { "\t" },
n => sub { "\n" },
+ E => sub { $_[0]->_user_info('email') },
+ U => sub { $_[0]->_user_info('name') },
+ T => sub { $_[0]->zilla->is_trial
+ ? (defined $_[1] ? $_[1] : '-TRIAL') : '' },
+ V => sub { $_[0]->zilla->version
+ . ($_[0]->zilla->is_trial
+ ? (defined $_[1] ? $_[1] : '-TRIAL') : '') },
},
};
@@ -52,6 +60,33 @@ has update_filename => (
default => sub { $_[0]->filename },
);
+has user_stash => (
+ is => 'ro',
+ isa => 'Str',
+ default => '%User'
+);
+
+has _user_stash_obj => (
+ is => 'ro',
+ isa => maybe_type( class_type('Dist::Zilla::Stash::User') ),
+ lazy => 1,
+ init_arg => undef,
+ default => sub { $_[0]->zilla->stash_named( $_[0]->user_stash ) },
+);
+
+sub _user_info {
+ my ($self, $field) = @_;
+
+ my $stash = $self->_user_stash_obj;
+
+ $self->log_fatal([
+ "You must enter your %s in the [%s] section in ~/.dzil/config.ini",
+ $field, $self->user_stash
+ ]) unless $stash and defined(my $value = $stash->$field);
+
+ return $value;
+}
+
sub section_header {
my ($self) = @_;
@@ -114,7 +149,6 @@ sub after_release {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SYNOPSIS
@@ -171,15 +205,45 @@ defaults to C<%-9v %{yyyy-MM-dd HH:mm:ss VVVV}d>
= time_zone
the timezone to use when generating the date; defaults to I<local>
+= user_stash
+the name of the stash where the user's name and email address can be found;
+defaults to C<%User>
+
=end :list
-The module allows the following sprintf-like format codes in the format:
+The module allows the following sprintf-like format codes in the C<format>:
+
+=begin :list
+
+= C<%v>
+The distribution version
+
+= C<%{-TRIAL}T>
+Expands to -TRIAL (or any other supplied string) if this
+is a trial release, or the empty string if not. A bare C<%T> means
+C<%{-TRIAL}T>.
+
+= C<%{-TRIAL}V>
+Equivalent to C<%v%{-TRIAL}T>, to allow for the application of modifiers such
+as space padding to the entire version string produced.
+
+= C<%{CLDR format}d>
+The date of the release. You can use any CLDR format supported by
+L<DateTime>. You must specify the format; there is no default.
+
+= C<%U>
+The name of the user making this release (from C<user_stash>).
-=for :list
-* v - the version of the dist
-* d - the CLDR format for L<DateTime>
-* n - a newline
-* t - a tab
+= C<%E>
+The email address of the user making this release (from C<user_stash>).
+
+= C<%n>
+A newline
+
+= C<%t>
+A tab
+
+=end :list
=head1 SEE ALSO
@@ -192,4 +256,3 @@ Dist::Zilla roles:
L<AfterRelease|Dist::Zilla::Plugin::AfterRelease>,
L<FileMunger|Dist::Zilla::Role::FileMunger>,
L<TextTemplate|Dist::Zilla::Role::TextTemplate>.
-
View
5 lib/Dist/Zilla/Plugin/PkgVersion.pm
@@ -119,7 +119,6 @@ sub munge_perl {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
@@ -128,4 +127,8 @@ L<PodVersion|Dist::Zilla::Plugin::PodVersion>,
L<AutoVersion|Dist::Zilla::Plugin::AutoVersion>,
L<NextRelease|Dist::Zilla::Plugin::NextRelease>.
+Other Dist::Zilla plugins:
+L<OurPkgVersion|Dist::Zilla::Plugin::OurPkgVersion> inserts version
+numbers using C<our $VERSION = '...';> and without changing line numbers
+
=cut
View
1  lib/Dist/Zilla/Plugin/PodVersion.pm
@@ -74,7 +74,6 @@ sub munge_pod {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/Prereqs.pm
@@ -180,7 +180,6 @@ sub register_prereqs {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Plugin/PruneFiles.pm
@@ -79,7 +79,6 @@ sub prune_files {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/PluginBundle/Basic.pm
@@ -30,7 +30,6 @@ sub configure {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 DESCRIPTION
View
1  lib/Dist/Zilla/PluginBundle/Classic.pm
@@ -33,7 +33,6 @@ sub configure {
__PACKAGE__->meta->make_immutable;
1;
-__END__
=head1 DESCRIPTION
View
1  lib/Dist/Zilla/Role/VersionProvider.pm
@@ -19,7 +19,6 @@ ignored.
requires 'provide_version';
1;
-__END__
=head1 SEE ALSO
View
1  lib/Dist/Zilla/Tutorial.pm
@@ -5,7 +5,6 @@ package Dist::Zilla::Tutorial;
use Carp ();
Carp::confess "you're not meant to use the tutorial, just read it!";
1;
-__END__
=head1 SYNOPSIS
View
155 t/plugins/nextrelease.t
@@ -5,7 +5,7 @@ use Test::More 0.88;
use lib 't/lib';
use Test::DZil;
-use Try::Tiny;
+use Test::Fatal;
local $ENV{TZ} = 'America/New_York';
@@ -96,16 +96,14 @@ END_CHANGES
"new version does not yet appear in source Changes file",
);
- try {
- local $ENV{DZIL_FAKERELEASE_FAIL} = 1;
- $tzil->release;
- } catch {
- like(
- $_,
- qr/DZIL_FAKERELEASE_FAIL set, aborting/i,
- "we can make FakeRelease fail when we want!"
- );
- };
+ like(
+ exception {
+ local $ENV{DZIL_FAKERELEASE_FAIL} = 1;
+ $tzil->release;
+ },
+ qr/DZIL_FAKERELEASE_FAIL set, aborting/i,
+ "we can make FakeRelease fail when we want!"
+ );
unlike(
$tzil->slurp_file('source/Changes'),
@@ -162,4 +160,139 @@ END_CHANGES
);
}
+{
+ local $ENV{TRIAL} = 1;
+
+ my $tzil_trial = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v%T", } ],
+ 'FakeRelease',
+ ),
+ },
+ },
+ );
+
+ $tzil_trial->build;
+
+ like(
+ $tzil_trial->slurp_file('build/Changes'),
+ qr{0.001-TRIAL},
+ "adding -TRIAL works",
+ );
+}
+
+{
+ local $ENV{TRIAL} = 1;
+
+ my $tzil_trial = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%-12V ohhai", } ],
+ 'FakeRelease',
+ ),
+ },
+ },
+ );
+
+ $tzil_trial->build;
+
+ like(
+ $tzil_trial->slurp_file('build/Changes'),
+ qr{0.001-TRIAL ohhai},
+ "adding -TRIAL with padding works",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U %E", } ],
+ 'FakeRelease',
+ ),
+ },
+ },
+ );
+
+ like(
+ exception { $tzil->build },
+ qr{\QYou must enter your name in the [%User] section\E},
+ "complains about missing name",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U <%E>", } ],
+ 'FakeRelease',
+ [ '%User' => { name => 'E.X. Ample',
+ email => 'me@example.com' } ],
+ ),
+ },
+ },
+ );
+
+ is(
+ exception { $tzil->build },
+ undef,
+ "build successfully with name & email",
+ );
+
+ like(
+ $tzil->slurp_file('build/Changes'),
+ qr{^0\.001 E\.X\. Ample <me\@example\.com>}m,
+ "adding name and email works",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U <%E>",
+ user_stash => '%Info' } ],
+ 'FakeRelease',
+ [ '%User' => '%Info' => { name => 'E.X. Ample',
+ email => 'me@example.com' } ],
+ ),
+ },
+ },
+ );
+
+ is(
+ exception { $tzil->build },
+ undef,
+ "build successfully with %Info stash",
+ );
+
+ like(
+ $tzil->slurp_file('build/Changes'),
+ qr{^0\.001 E\.X\. Ample <me\@example\.com>}m,
+ "adding name and email from %Info works",
+ );
+}
+
done_testing;

No commit comments for this range

Something went wrong with that request. Please try again.