[Bps-public-commit] r12178 - in sd/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Thu May 8 20:41:17 EDT 2008
Author: sartak
Date: Thu May 8 20:41:17 2008
New Revision: 12178
Added:
sd/trunk/t/01-dependencies.t
Modified:
sd/trunk/ (props changed)
sd/trunk/Makefile.PL
Log:
r55476 at onn: sartak | 2008-05-08 20:41:13 -0400
t/01-dependencies.t, add our deps to Makefile.PL
Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL (original)
+++ sd/trunk/Makefile.PL Thu May 8 20:41:17 2008
@@ -5,6 +5,16 @@
license('MIT');
version_from('lib/App/SD.pm');
-requires 'Prophet';
+requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
+requires 'Proc::InvokeEditor';
+requires 'RT::Client::REST'; # RT::Client::REST::Ticket
+requires 'DateTime::Format::HTTP';
+
+features(
+ 'Hiveminder sync' => [
+ -default => 1,
+ recommends('Jifty'),
+ ],
+);
&WriteAll;
Added: sd/trunk/t/01-dependencies.t
==============================================================================
--- (empty file)
+++ sd/trunk/t/01-dependencies.t Thu May 8 20:41:17 2008
@@ -0,0 +1,79 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+Makes sure that all of the modules that are 'use'd are listed in the
+Makefile.PL as dependencies.
+
+=cut
+
+use Test::More;
+use File::Find;
+eval 'use Module::CoreList';
+if ($@) { plan skip_all => 'Module::CoreList not installed' }
+
+plan 'no_plan';
+
+my %used;
+find( \&wanted, qw/ lib bin t / );
+
+sub wanted {
+ return unless -f $_;
+ return if $File::Find::dir =~ m!/.svn($|/)!;
+ return if $File::Find::name =~ /~$/;
+ return if $File::Find::name =~ /\.(pod|html)$/;
+
+ # read in the file from disk
+ my $filename = $_;
+ local $/;
+ open( FILE, $filename ) or return;
+ my $data = <FILE>;
+ close(FILE);
+
+ # strip pod, in a really idiotic way. Good enough though
+ $data =~ s/^=head.+?(^=cut|\Z)//gms;
+
+ # look for use and use base statements
+ $used{$1}{$File::Find::name}++ while $data =~ /^\s*use\s+([\w:]+)/gm;
+ while ( $data =~ m|^\s*use base qw.([\w\s:]+)|gm ) {
+ $used{$_}{$File::Find::name}++ for split ' ', $1;
+ }
+}
+
+my %required;
+{
+ local $/;
+ ok( open( MAKEFILE, "Makefile.PL" ), "Opened Makefile" );
+ my $data = <MAKEFILE>;
+ close(FILE);
+ while ( $data =~ /^\s*?(?:requires|recommends).*?([\w:]+)'(?:\s*=>\s*['"]?([\d\.]+)['"]?)?.*?(?:#(.*))?$/gm ) {
+ $required{$1} = $2;
+ if ( defined $3 and length $3 ) {
+ $required{$_} = undef for split ' ', $3;
+ }
+ }
+}
+
+for ( sort keys %used ) {
+ my $first_in = Module::CoreList->first_release($_);
+ next if defined $first_in and $first_in <= 5.00803;
+ next if /^(SVB|Prophet|App::SD|inc|t)(::|$)/;
+
+ #warn $_;
+ ok( exists $required{$_}, "$_ in Makefile.PL" )
+ or diag( "used in ", join ", ", sort keys %{ $used{$_} } );
+ delete $used{$_};
+ delete $required{$_};
+}
+
+for ( sort keys %required ) {
+ my $first_in = Module::CoreList->first_release( $_, $required{$_} );
+ fail("Required module $_ (v. $required{$_}) is in core since $first_in")
+ if defined $first_in and $first_in <= 5.008003;
+}
+
+1;
+
More information about the Bps-public-commit
mailing list