#!/home/ben/software/install/bin/perl use warnings; use strict; use Test::CPAN::Changes; use JSON::Parse 'parse_json'; use Path::Tiny; use Test::More; my $m = 'MYMETA.json'; if (! -f $m) { $m = 'META.json'; if (! -f $m) { die "No $m"; } } my $j = path ($m)->slurp (); my $p = parse_json ($j); my $private; if (-f 'PRIVATE') { $private = 1; } ok (@{$p->{author}}, "author in meta"); like ($p->{author}[0], qr/benkasminbullock\@gmail\.com/, "correct email in author string"); ok ($p->{abstract}, "abstract in meta"); my $version = $p->{version}; # Don't bother checking for "Changes" if it's a private module; the # git log is enough. if (! $private) { changes_file_ok ("Changes", {version => $version}); } my $subdir = "$p->{name}-$version"; my $tarfile = "$subdir.tar.gz"; my @lines = `tar tfz $tarfile`; my @bads = (qw/core object backup makefile buildpl pm_to_blib/); my %has; for (@lines) { s/^\s+|\s+$//g; if (/\.core$/) { $has{core} = 1; } if (/\.o$/) { $has{object} = 1; } if (/^#/ || /~$/) { $has{backup} = 1; } if (m!\bMakefile$!) { $has{makefile} = 1; } if (m!\bbuild\.pl$!) { $has{buildpl} = 1; } } for (@bads) { ok (! $has{$_}, "no $_ file in tarfile"); } my %lines; @lines{@lines} = @lines; if (! $private) { ok ($lines{"$subdir/Changes"}, "Changes in tarfile"); ok ($lines{"$subdir/README"}, "README in tarfile"); } ok (! $lines{"$subdir/a.out"}, "no a.out in tarfile"); ok (! $lines{"$subdir/pm_to_blib"}, "no pm_to_blib in tarfile"); ok (! $lines{"$subdir/build.pl"}, "no 'build.pl' in tarfile"); ok (! $lines{"$subdir/Makefile"}, "no Makefile in tarfile"); done_testing (); # Local variables: # mode: perl # End: