Skip Menu |

This queue is for tickets about the Dist-Zilla-Plugin-ReportVersions-Tiny CPAN distribution.

Maintainer(s)' notes

This module is deprecated!

This distribution has reached end-of-life now that better alternatives exist.

The recommended alternative is Dist::Zilla::Plugin::Test::ReportPrereqs.

Report information
The Basics
Id: 57978
Status: resolved
Priority: 0/
Queue: Dist-Zilla-Plugin-ReportVersions-Tiny

People
Owner: Nobody in particular
Requestors: APOCAL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.00
Fixed in: 1.01



Subject: Some small patches
Hello, First of all, thanks for writing this! I originally wanted to use ReportVersions but felt it was too "heayweight" and ignored it. I saw this pop up in my CPAN feed and decided to check it out. It works nicely for me! However, I have a distaste of "no_plan" and wanted to see the prereq versions I requested. Here's 2 patches for those features. I hope it isn't too much trouble to merge in my patches, thanks! -- ~Apocalypse
Subject: no_noplan.patch
diff -urbd Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm --- Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm 2010-05-30 05:53:25.000000000 -0700 +++ Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm 2010-05-30 09:29:32.000000000 -0700 @@ -11,11 +11,23 @@ sub mvp_multivalue_args { qw{exclude} }; has exclude => (is => 'ro', isa => 'ArrayRef', default => sub { [] }); - our $template = q{use strict; use warnings; -use Test::More 'no_plan'; # the safest way to avoid Test::NoWarnings breaking - # our expectations is no_plan, not done_testing! + +# Smart loading of tests +my $numtests; +BEGIN { + $numtests = 1; + + eval "use Test::NoWarnings"; + if ( ! $@ ) { + # increment by one + $numtests++; + + } +} + +use Test::More tests => $numtests; my $v = "\n";
Subject: showversion.patch
diff -urbd Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm --- Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm 2010-05-30 05:53:25.000000000 -0700 +++ Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/lib/Dist/Zilla/Plugin/ReportVersions/Tiny.pm 2010-05-30 09:58:18.000000000 -0700 @@ -26,7 +26,8 @@ # Now, our module version dependencies: sub pmver { - my ($module) = @_; + my ($module,$wanted) = @_; + $wanted = " (want $wanted)"; my $pmver; eval "require $module;"; if ($@) { @@ -50,13 +51,12 @@ } # So, we should be good, right? - return sprintf('%-40s => %s%s', $module, $pmver, "\n"); + return sprintf('%-40s => %-10s%-15s%s', $module, $pmver, $wanted, "\n"); } {{ for my $module (@modules) { - my $text = "eval { \$v .= pmver('${module}') };\n"; - $OUT .= $text; + $OUT .= "eval { \$v .= pmver('" . $module->[0] . "','" . $module->[1] . "') };\n"; } }} @@ -78,36 +78,33 @@ my ($self) = @_; # Extract the set of modules we depend on. - my @modules; - { my %modules; my $prereq = $self->zilla->prereqs->as_string_hash; + for my $phase (keys %{ $prereq || {} }) { for my $type (keys %{ $prereq->{$phase} || {} }) { for my $module (keys %{ $prereq->{$phase}->{$type} || {} }) { - $modules{$module} = 1; + next if exists $modules{$module} and $modules{$module} > $prereq->{$phase}->{$type}->{$module}; + + $modules{$module} = $prereq->{$phase}->{$type}->{$module}; } } } - # This is all I ever really cared about. - @modules = sort { lc($a) cmp lc($b) } - grep { - my $name = $_; - my $found = grep { $name =~ m{$_} } @{ $self->exclude }; - $found == 0; + # cleanup + foreach my $module ( keys %modules ) { + if ( $module eq 'perl' or grep { $module =~ m{$_} } @{ $self->exclude } ) { + delete $modules{$module}; } - grep { $_ ne 'perl' } - keys %modules; } - return @modules; + return [ map { [ $_ => $modules{$_} ] } sort keys %modules ]; } sub generate_test_from_prereqs { my ($self) = @_; my $content = $self->fill_in_string($template, { - modules => [$self->applicable_modules] + modules => $self->applicable_modules }); return $content; Only in Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/: Makefile.old diff -urbd Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/t/exclude.t Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/t/exclude.t --- Dist-Zilla-Plugin-ReportVersions-Tiny-1.00/t/exclude.t 2010-05-30 05:53:25.000000000 -0700 +++ Dist-Zilla-Plugin-ReportVersions-Tiny-1.00-MYVER/t/exclude.t 2010-05-30 10:01:39.000000000 -0700 @@ -34,15 +34,15 @@ { $prereq = { - testing => { requires => { baz => 1, quux => 1 } }, + testing => { requires => { baz => 1, quux => 1, Moose => 5 } }, build => { requires => { baz => 2, foox => 1 } }, }; - my @modules; - lives_ok { @modules = $rv->applicable_modules } + my $modules; + lives_ok { $modules = $rv->applicable_modules } "we can collect the applicable modules for the distribution"; - eq_or_diff \@modules, [qw{baz foox quux}], + eq_or_diff $modules, [[baz => 2], [foox => 1], [quux => 1]], "we collected the first round of modules as expected"; }
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #57978] Some small patches
Date: Mon, 31 May 2010 23:52:10 +1000
To: bug-Dist-Zilla-Plugin-ReportVersions-Tiny [...] rt.cpan.org
From: Daniel Pittman <daniel [...] rimspace.net>
G'day Apocalypse. Show quoted text
> First of all, thanks for writing this! I originally wanted to use > ReportVersions but felt it was too "heayweight" and ignored it. I saw this > pop up in my CPAN feed and decided to check it out. > > It works nicely for me!
Well, thank you. I am glad it works, and I certainly feel it meets my needs with an awful lot less code and complexity than the non-tiny version. Show quoted text
> However, I have a distaste of "no_plan" and wanted to see the prereq > versions I requested. Here's 2 patches for those features. > > I hope it isn't too much trouble to merge in my patches, thanks!
It wasn't, and I have released 1.01 to CPAN just a moment ago with them integrated. You might find they have mutated a little on the way through, as your ideas and some practical testing highlighted some extra improvements I could make. Please let me know if you don't feel the tests, as written, resolve your concerns. I value the experience you have in the Perl space, as a module author, and am quite happy to take advantage of that to improve my own code. Regards, Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons
Thanks for the changes, I really appreciate it! Yeah, I see some code mutated on it's way to your repo but that's ok as long as the desired features ended up in it :) -- ~Apocalypse