4 use ExtUtils::MakeMaker;
5 use ExtUtils::Manifest 'maniread';
6 use File::Spec::Functions qw(devnull);
10 GetOptions("r" => \$report);
15 $last_tag = `git describe --abbrev=0`;
20 or plan skip_all => "Only usable in a git checkout";
22 my $mani = maniread();
24 my @subdirs = qw(PNG TIFF GIF JPEG W32 T1 FT2 ICO SGI Mandelbrot CountColor DynTest);
26 my $subdir_re = "^(?:" . join("|", @subdirs) . ")/";
29 grep /\.pm$/ && !/$subdir_re/ && !/^t\// && $_ ne 'Imager.pm', keys %$mani;
31 plan tests => scalar(@subdirs) + scalar(@pm_files)
34 for my $dir (@subdirs) {
35 my @changes = `git log --abbrev --oneline $last_tag..HEAD -- $dir`;
36 my @more_changes = `git status --porcelain -- $dir`;
38 print "$dir updated\n" if @changes || @more_changes;
43 @changes || @more_changes
44 or skip "No changes for $dir", 1;
45 my $vfile = "$dir/$dir.pm";
46 my $current = eval { MM->parse_version($vfile) };
47 my $last_rel_content = get_file_from_git($vfile, $last_tag);
48 my $last = eval { MM->parse_version(\$last_rel_content) };
49 unless (isnt($current, $last, "$dir updated, $vfile version bump")) {
50 diag(@changes, @more_changes);
57 for my $file (@pm_files) {
58 my @changes = `git log --abbrev --oneline $last_tag..HEAD $file`;
59 my @more_changes = `git status --porcelain $file`;
62 @changes || @more_changes
63 or skip "No changes for $file", 1;
64 my $current = eval { MM->parse_version($file) };
65 my $last_rel_content = get_file_from_git($file, $last_tag);
66 my $last = eval { MM->parse_version(\$last_rel_content) };
67 unless (isnt($current, $last, "$file updated, version bump")) {
68 diag(@changes, @more_changes);
74 sub get_file_from_git {
75 my ($file, $tag) = @_;
78 return scalar `git --no-pager show $tag:$file 2>$null`;