App-prepare4release

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        link to repo LICENSE blob with --github/--gitlab and git.default_branch.
        Perl badge minimum: min_perl_version / perl_min in JSON, else MIN_PERL_VERSION.
        README badges: no HTML comment wrappers; strip prior shields by line pattern.
        MetaCPAN matrix ceiling: GET /v1/release/perl (fix bogus sort=version first hit).
        Ceiling tag: robust version parse; reject minors below 10 (bogus v5.8.x data).
        GitHub CI: use shogo82148/actions-setup-perl (shivammathur/setup-perl does not exist).
        Makefile.PL: TEST_REQUIRES only Test2::Suite; xt/author deps in META develop;
        generated CI uses cpanm --installdeps . without --with-develop.
        CI: perl Makefile.PL before installdeps; explicit cpanm Test2::Suite (cpanfile shortcut).
        t/helpers-more.t: unit tests for URL/git helpers, badges, license inference,
        README badge insert/strip, parse_argv, MetaCPAN ceiling helpers, list_files_for_eol_xt.
        t/more-coverage.t: integration run() via fork+exec (FindBin-safe), apply_ci_files,
        warn_legacy_test_frameworks, Makefile postamble/META_MERGE, strip POD badges, etc.
        t/coverage-edge.t: MetaCPAN/HTTP fallbacks (mocked HTTP::Tiny::get), empty CI matrix,
        split_pm without __END__, ensure_meta_merge skip, license/min-perl edge cases.
        Fix _find_exe_in_path: was using invocant as program name (method needs ($class, $name)).
        Integration runs use --verbose to exercise run() diagnostic warnings.

MANIFEST  view on Meta::CPAN

t/coverage-edge.t
t/helpers-more.t
t/more-coverage.t
t/perl-matrix.t
t/pm-min-version.t
t/postamble-crlf.t
xt/author/compile-internal.t
xt/author/compile.t
xt/author/cpants.t
xt/author/dependent-modules.t
xt/author/eol.t
xt/author/kwalitee.t
xt/author/minimum-version.t
xt/author/pause-permissions.t
xt/author/pod-coverage.t
xt/author/pod.t
xt/author/portability.t
xt/author/synopsis.t
xt/author/version.t
xt/metacpan-live.t

README.md  view on Meta::CPAN

only with `--gitlab` (host from `git.server`, else from `git.repo` URL, else
`gitlab.com`). License shield (always blue) uses the same key as ExtUtils::MakeMaker
(`Makefile.PL` `LICENSE`), or the type inferred from a root `LICENSE` file when
present; the link is the repository `LICENSE` blob when that file exists and
`--github` or `--gitlab` is set (branch from `git.default_branch`, default
`main`), otherwise the usual canonical license URL. Minimum Perl on the shield
comes from `min_perl_version` / `perl_min` in the JSON file, else
`Makefile.PL` `MIN_PERL_VERSION`, else the stricter of makefile and main module
(as for CI).
- Creates author tests under `xt/author/` when missing: `pod.t` ([Test::Pod](https://metacpan.org/pod/Test%3A%3APod)),
`eol.t` ([Test::EOL](https://metacpan.org/pod/Test%3A%3AEOL)), `pod-coverage.t` ([Test::Pod::Coverage](https://metacpan.org/pod/Test%3A%3APod%3A%3ACoverage)), using
[Test2::V1](https://metacpan.org/pod/Test2%3A%3AV1).
- With `--cpan`, after the steps above: ensures `LICENSE` exists. The license
_type_ is taken from `Makefile.PL` `LICENSE` (via the same snippet scan as
elsewhere in this tool); if that is missing, _perl_ (same terms as Perl 5) is
assumed. The file text is downloaded from official upstream sources (for
`perl`, the `Artistic` and `Copying` files from the Perl 5 repository; for
`apache_2`, `mit`, `gpl_3`, etc., the canonical license URLs). If a fetch
fails, a short built-in fallback is written. If `README` is missing but
`README.md` exists, writes a short stub `README` pointing readers to
`README.md`. Creates a default `MANIFEST.SKIP` when none is present (skipping

lib/App/prepare4release.pm  view on Meta::CPAN


	my $out = $code . "\n__END__\n" . $new_pod;
	open my $out_fh, '>:encoding(UTF-8)', $vf
		or croak "Cannot write '$vf': $!";
	print {$out_fh} $out;
	close $out_fh;
	warn "[prepare4release] removed legacy POD badge block from $vf\n" if $verbose;
	return;
}

sub list_files_for_eol_xt {
	my ( $class, $cwd ) = @_;
	my @out;

	for my $f (qw(Makefile.PL Build.PL cpanfile prepare4release.json)) {
		my $p = File::Spec->catfile( $cwd, $f );
		push @out, $f if -f $p;
	}

	push @out, map { File::Spec->abs2rel( $_, $cwd ) }
		$class->find_lib_pm_files($cwd);

lib/App/prepare4release.pm  view on Meta::CPAN

		Test::Pod::Coverage->import;
		1;
	} or skip_all 'Test::Pod::Coverage is required for author tests';
}

all_pod_coverage_ok();
XT
		$class->_write_if_absent( $pc_xt, $body, $verbose );
	}

	my @eol = $class->list_files_for_eol_xt($cwd);
	my $eol_xt = File::Spec->catfile( $xtd, 'eol.t' );
	if ( !-e $eol_xt ) {
		my $list = join "\n", map { '    ' . $_ } @eol;
		my $head = <<'EOL_HEAD';
#!perl
use strict;
use warnings;
use Test2::V1;
use Test2::Tools::Basic qw(skip_all done_testing);

BEGIN {
	eval {
		require Test::EOL;
		Test::EOL->import;
		1;
	} or skip_all 'Test::EOL is required for author tests';
}

my @files = qw(
EOL_HEAD
		my $tail = <<'EOL_TAIL';
);

eol_unix_ok($_) for @files;

done_testing;
EOL_TAIL
		my $body = $head . $list . $tail;
		$class->_write_if_absent( $eol_xt, $body, $verbose );
	}

	return;
}

sub _write_if_absent {
	my ( $class, $path, $body, $verbose ) = @_;
	open my $fh, '>:encoding(UTF-8)', $path
		or croak "Cannot write '$path': $!";
	print {$fh} $body;

lib/App/prepare4release.pm  view on Meta::CPAN

present; the link is the repository F<LICENSE> blob when that file exists and
C<--github> or C<--gitlab> is set (branch from C<git.default_branch>, default
C<main>), otherwise the usual canonical license URL. Minimum Perl on the shield
comes from C<min_perl_version> / C<perl_min> in the JSON file, else
F<Makefile.PL> C<MIN_PERL_VERSION>, else the stricter of makefile and main module
(as for CI).

=item *

Creates author tests under F<xt/author/> when missing: C<pod.t> (L<Test::Pod>),
C<eol.t> (L<Test::EOL>), C<pod-coverage.t> (L<Test::Pod::Coverage>), using
L<Test2::V1>.

=item *

With C<--cpan>, after the steps above: ensures F<LICENSE> exists. The license
I<type> is taken from F<Makefile.PL> C<LICENSE> (via the same snippet scan as
elsewhere in this tool); if that is missing, I<perl> (same terms as Perl 5) is
assumed. The file text is downloaded from official upstream sources (for
C<perl>, the F<Artistic> and F<Copying> files from the Perl 5 repository; for
C<apache_2>, C<mit>, C<gpl_3>, etc., the canonical license URLs). If a fetch

t/coverage-deep.t  view on Meta::CPAN


	my $id = App::prepare4release->resolve_identity(
		$tmp,
		{},
		{}
	);
	is( $id->{module_name}, 'Only::Lib', 'resolve_identity from first lib pm' );
	ok( $id->{version_from_path}, 'version_from_path from scan' );
}

# --- ensure_xt_author_tests writes eol.t list -------------------------------

{
	my $tmp = tempdir( CLEANUP => 1 );
	make_path( File::Spec->catfile( $tmp, 'lib' ) );
	open my $pm, '>', File::Spec->catfile( $tmp, 'lib', 'E.pm' ) or die $!;
	print {$pm} "package E; our \$VERSION=1; 1;\n";
	close $pm;

	App::prepare4release->ensure_xt_author_tests( $tmp, 0 );
	my $eol = File::Spec->catfile( $tmp, 'xt', 'author', 'eol.t' );
	ok( -e $eol, 'eol.t created' );
	open my $in, '<', $eol or die $!;
	local $/;
	my $b = <$in>;
	like( $b, qr/lib\/E\.pm/, 'eol.t lists scanned files' );
}

# --- integration: run --gitlab --------------------------------------------

sub _write_dist_gitlab {
	my ($root) = @_;
	open my $fj, '>:encoding(UTF-8)', File::Spec->catfile( $root, 'prepare4release.json' );
	print {$fj} qq({"git":{"repo":"group/gitlab-proj"},"dependencies":{"skip":true}}\n);
	close $fj;
	open my $fm, '>:encoding(UTF-8)', File::Spec->catfile( $root, 'Makefile.PL' );

t/helpers-more.t  view on Meta::CPAN

}

my $troot = tempdir( CLEANUP => 1 );
mkdir File::Spec->catfile( $troot, 't' );
{
	open my $fh, '>:encoding(UTF-8)',
		File::Spec->catfile( $troot, 't', 'z.t' ) or die $!;
	print {$fh} "use Test2::V1;\n";
	close $fh;
}
my @eol = App::prepare4release->list_files_for_eol_xt($troot);
ok( ( grep { $_ eq 't/z.t' } @eol ), 'list_files_for_eol_xt includes t/*.t' );

eval {
	App::prepare4release->load_config_file(
		File::Spec->catfile( $tmp, 'nope.json' ) );
};
ok( $@, 'load_config_file missing file croaks' );

done_testing;

xt/author/eol.t  view on Meta::CPAN

    t/ci-ensure.t
    t/ci-render.t
    t/config-load.t
    t/perl-matrix.t
    t/pm-min-version.t
    xt/metacpan-live.t
    xt/author/compile-internal.t
    xt/author/compile.t
    xt/author/cpants.t
    xt/author/dependent-modules.t
    xt/author/eol.t
    xt/author/kwalitee.t
    xt/author/minimum-version.t
    xt/author/pause-permissions.t
    xt/author/pod-coverage.t
    xt/author/pod.t
    xt/author/portability.t
    xt/author/synopsis.t
    xt/author/version.t
);

eol_unix_ok($_) for @files;

done_testing;

xt/author/pod-coverage.t  view on Meta::CPAN

				git_repo_name
				git_server
				gitlab_ci_badge_host
				gitlab_ci_badge_urls
				https_base
				infer_license_key_from_license_file
				infer_license_key_from_text
				license_badge_info
				license_badge_label_and_href
				license_file_blob_url
				list_files_for_eol_xt
				load_config_file
				makefile_scalar_keys_from_config
				ensure_makefile_metadata_from_config
				makefile_has_pod2github
				makefile_has_pod2markdown
				makefile_pl_path
				meta_merge_block
				min_perl_version_from_makefile_content
				min_perl_version_from_pm_content
				module_repo



( run in 1.122 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )