[Jifty-commit] r3676 - in apps/CASPlus/trunk: t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jul 11 22:59:08 EDT 2007
Author: sterling
Date: Wed Jul 11 22:59:06 2007
New Revision: 3676
Modified:
apps/CASPlus/trunk/ (props changed)
apps/CASPlus/trunk/t/00-dependencies.t
Log:
r8038 at dynpc145: andrew | 2007-07-11 21:58:30 -0500
Replaced the broken dependency checker with the one from Jifty adapated for this application.
Modified: apps/CASPlus/trunk/t/00-dependencies.t
==============================================================================
--- apps/CASPlus/trunk/t/00-dependencies.t (original)
+++ apps/CASPlus/trunk/t/00-dependencies.t Wed Jul 11 22:59:06 2007
@@ -1,15 +1,73 @@
#!/usr/bin/env perl
-use strict;
+
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 qw(no_plan);
+use File::Find;
+use Module::CoreList;
+
+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}{$filename}++ while $data =~ /^\s*use\s+([\w:]+)/gm;
+ while ($data =~ m|^\s*use base qw.([\w\s:]+)|gm) {
+ $used{$_}{$filename}++ for split ' ', $1;
+ }
+}
+
+my %required;
+{
+ local $/;
+ ok(open(MAKEFILE,"Makefile.PL"), "Opened Makefile");
+ my $data = <MAKEFILE>;
+ close(FILE);
+ while ($data =~ /^\s*?(?:requires|recommends)\(?\s*'([\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 /^(CASPlus|Jifty|inc|t)(::|$)/;
+ 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;
+}
-use Test::More;
+1;
-SKIP: {
- eval 'use Test::Dependencies plan => 1';
- skip 'Test::Dependencies is not available.', 1 if $@;
-
- TODO: {
- local $TODO = 'Test::Dependencies does not work with Jifty.';
- ok_dependencies();
- };
-};
More information about the Jifty-commit
mailing list