NAME => Meta->name || die 'The Module::Install metadata must be available at this point but is not - did you rearrange the Makefile.PL...?',
});
+ # Crutch for DISTBUILDING_IN_HELL
+ # Spits back a working dos2unix snippet to be used on the supplied path(s)
+ # Ironically EUMM's dos2unix is broken on win32 itself - it does
+ # not take into account the CRLF layer present on win32
+ my $crlf_fixup = sub {
+ return '' unless ($^O eq 'MSWin32' or $^O eq 'cygwin');
+ my $targets = join ', ', map { "q($_)" } @_;
+ "\t" . $mm_proto->oneliner( qq(\$ENV{PERLIO}='unix' and system( \$^X, qw( -MExtUtils::Command -e dos2unix -- ), $targets ) ) );
+ };
+
# we are in the process of (re)writing the makefile - some things we
# call below very well may fail
local $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION} = 1;
CREATE TABLE artist (
artistid INTEGER PRIMARY KEY,
- name TEXT NOT NULL
+ name TEXT NOT NULL
);
CREATE TABLE cd (
trackid INTEGER PRIMARY KEY,
cd INTEGER NOT NULL REFERENCES cd(cdid),
title TEXT NOT NULL
-);
\ No newline at end of file
+);
},
},
- test_notabs => {
- req => {
- 'Test::NoTabs' => '0.9',
- },
- },
-
- test_eol => {
+ test_whitespace => {
req => {
'Test::EOL' => '1.0',
+ 'Test::NoTabs' => '0.9',
},
},
# inject an explicit xt test run, mainly to check the contents of
# lib and the generated POD's *before* anything is copied around
+#
+# at the end rerun the whitespace test in the distdir, to make sure everything
+# is pristine
postamble <<"EOP";
dbic_clonedir_copy_generated_pod : test_xt
# perl cmd
join( ' ',
'$(ABSPERLRUN)',
- # $'s need to be escaped (doubled) before inserting into the Makefile
- map { $mm_proto->quote_literal($_) } qw(-e $$ENV{RELEASE_TESTING}=1;)
+ map { $mm_proto->quote_literal($_) } qw(-e $ENV{RELEASE_TESTING}=1;)
),
# test list
join( ' ',
)
]}
+create_distdir : dbic_distdir_retest_whitespace
+
+dbic_distdir_retest_whitespace :
+\t@{[
+ $mm_proto->cd (
+ '$(DISTVNAME)',
+ $mm_proto->test_via_harness(
+ # perl cmd
+ join( ' ',
+ '$(ABSPERLRUN)',
+ map { $mm_proto->quote_literal($_) } qw(-Ilib -e $ENV{RELEASE_TESTING}=1;$ENV{DBICTEST_NO_MAKEFILE_VERIFICATION}=1;)
+ ),
+ 'xt/whitespace.t'
+ )
+ )
+]}
+
EOP
# keep the Makefile.PL eval happy
# on some OSes generated files may have an incorrect \n - fix it
# so that the xt tests pass on a fresh checkout (also shipping a
# dist with CRLFs is beyond obnoxious)
-#
-# Ironically EUMM's dos2unix is broken on win32 itself - it does
-# not take into account the CRLF layer present on win32
-# do the ENV trick again
if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
-
{
local $ENV{PERLIO} = 'unix';
system( $^X, qw( -MExtUtils::Command -e dos2unix -- ), $pod_dir );
postamble <<"EOP";
-test_xt : dbic_fixup_generated_pod
+clonedir_post_generate_files : pod_crlf_fixup
-dbic_fixup_generated_pod :
-\t@{[ $mm_proto->oneliner( qq(\$\$ENV{PERLIO}='unix' and system( \$\$^X, qw( -MExtUtils::Command -e dos2unix -- ), q($pod_dir) ) ) ) ]}
+pod_crlf_fixup :
+@{[ $crlf_fixup->($pod_dir) ]}
EOP
}
-
-# copy the contents of $pod_dir over to the workdir
-# (yes, overwriting is fine, though nothing should reside there)
{
postamble <<"EOP";
\t@{[
$mm_proto->oneliner("install([ from_to => {q($pod_dir) => File::Spec->curdir(), write => q($pod_dir.packlist)}, verbose => 0, uninstall_shadows => 0, skip => [] ])", ['-MExtUtils::Install'])
]}
+
EOP
}
dbic_clonedir_regen_test_ddl :
\t\$(ABSPERLRUN) -Ilib -- maint/gen_schema > @{[ $mm_proto->quote_literal($ddl_fn) ]}
-
+@{[ $crlf_fixup->($ddl_fn) ]}
EOP
+
+
# keep the Makefile.PL eval happy
1;
# make sure we delete and re-create the file - just an append
# will not do what one expects, because on unixy systems the
# target is symlinked to the original
-
-# FIXME also on win32 EU::Command::cat() adds crlf even if the
-# source files do not contain any :(
-my $crlf_fixup = ($^O eq 'MSWin32' or $^O eq 'cygwin')
- ? "\t@{[ $mm_proto->oneliner( qq(\$\$ENV{PERLIO}='unix' and system( \$\$^X, qw( -MExtUtils::Command -e dos2unix -- ), q(\$(DISTVNAME)/script/dbicadmin) ) ) ) ]}"
- : ''
-;
postamble <<"EOP";
create_distdir : dbic_distdir_dbicadmin_pod_inject
dbic_distdir_dbicadmin_pod_inject :
\t\$(RM_F) \$(DISTVNAME)/script/dbicadmin
\t@{[ $mm_proto->oneliner('cat', ['-MExtUtils::Command']) ]} script/dbicadmin maint/.Generated_Pod/dbicadmin.pod > \$(DISTVNAME)/script/dbicadmin
-$crlf_fixup
+
+# FIXME also on win32 EU::Command::cat() adds crlf even if the
+# source files do not contain any :(
+@{[ $crlf_fixup->('$(DISTVNAME)/script/dbicadmin') ]}
EOP
# keep the Makefile.PL eval happy
+++ /dev/null
-use warnings;
-use strict;
-
-use Test::More;
-use File::Glob 'bsd_glob';
-use lib 't/lib';
-use DBICTest;
-
-require DBIx::Class;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_notabs') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_notabs');
- $ENV{RELEASE_TESTING}
- ? die ("Failed to load release-testing module requirements: $missing")
- : plan skip_all => "Test needs: $missing"
-}
-
-# FIXME - temporary workaround for RT#82033
-# also add all scripts (no extension) and some extra extensions
-# we want to check
-{
- no warnings 'redefine';
-
- *Test::EOL::_is_perl_module = sub {
- $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|json|proto)$/i || $_[0] =~ /::/;
- }
-}
-
-Test::NoTabs::all_perl_files_ok(
- qw/t xt lib script examples maint/,
-);
-
-# check some non-"perl files" in the root separately
-# use .gitignore as a guide of what to skip
-# (or do not test at all if no .gitignore is found)
-if (open(my $gi, '<', '.gitignore')) {
- my $skipnames;
- while (my $ln = <$gi>) {
- next if $ln =~ /^\s*$/;
- chomp $ln;
- $skipnames->{$_}++ for bsd_glob($ln);
- }
-
- for my $fn (bsd_glob('*')) {
- next if $skipnames->{$fn};
- next unless -f $fn;
- Test::NoTabs::notabs_ok($fn);
- }
-}
-
-# FIXME - Test::NoTabs declares 'no_plan' which conflicts with done_testing
-# https://github.com/schwern/test-more/issues/14
-#done_testing;
use DBICTest;
require DBIx::Class;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_eol') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_eol');
+unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_whitespace') ) {
+ my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_whitespace');
$ENV{RELEASE_TESTING}
? die ("Failed to load release-testing module requirements: $missing")
: plan skip_all => "Test needs: $missing"
}
-# FIXME - temporary workaround for RT#82032
+# FIXME - temporary workaround for RT#82032, RT#82033
# also add all scripts (no extension) and some extra extensions
# we want to check
{
no warnings 'redefine';
+ my $is_pm = sub {
+ $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|sql|json|proto)$/i || $_[0] =~ /::/;
+ };
- *Test::EOL::_is_perl_module = sub {
- $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|json|proto)$/i || $_[0] =~ /::/;
- }
+ *Test::EOL::_is_perl_module = $is_pm;
+ *Test::NoTabs::_is_perl_module = $is_pm;
}
-Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 },
- qw/t xt lib script examples maint/,
-);
+my @pl_targets = qw/t xt lib script examples maint/;
+Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, @pl_targets);
+Test::NoTabs::all_perl_files_ok(@pl_targets);
# check some non-"perl files" in the root separately
# use .gitignore as a guide of what to skip
$skipnames->{$_}++ for bsd_glob($ln);
}
+ # that we want to check anyway
+ delete $skipnames->{'META.yml'};
+
for my $fn (bsd_glob('*')) {
next if $skipnames->{$fn};
next unless -f $fn;
Test::EOL::eol_unix_ok($fn, { trailing_whitespace => 1 });
+ Test::NoTabs::notabs_ok($fn);
}
}
-# FIXME - Test::EOL declares 'no_plan' which conflicts with done_testing
+# FIXME - Test::NoTabs and Test::EOL declare 'no_plan' which conflicts with done_testing
# https://github.com/schwern/test-more/issues/14
#done_testing;