[Rt-commit] r10049 - rt/branches/3.7-EXPERIMENTAL/sbin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Dec 23 23:17:36 EST 2007


Author: sunnavy
Date: Sun Dec 23 23:17:36 2007
New Revision: 10049

Modified:
   rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in

Log:
added --list-deps arg to make _require.yml

Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in	Sun Dec 23 23:17:36 2007
@@ -65,13 +65,15 @@
     'with-MODPERL2',                      'with-DEV',
     'with-STANDALONE',
     'download=s',
-    'repository=s'
+    'repository=s',
+    'list-deps'
 );
 
 unless (keys %args) {
     help();
     exit(0);
 }
+
 # Set up defaults
 my %default = (
     'with-MASON' => 1,
@@ -93,7 +95,7 @@
   sub section {
     my $s = shift;
     $section = $s;
-    print "$s:\n";
+    print "$s:\n" unless $args{'list-deps'};
   }
 
   sub print_found {
@@ -101,34 +103,39 @@
     my $test = shift;
     my $extra = shift;
 
-    if ($args{'v'} or not $test or $always_show_sections{$section}) {
-      print "\t$msg...";
-      print $test ? "found" : "MISSING";
-      print "\n";
-    }
+    unless ( $args{'list-deps'} ) {
+        if ( $args{'v'} or not $test or $always_show_sections{$section} ) {
+            print "\t$msg...";
+            print $test ? "found" : "MISSING";
+            print "\n";
+        }
 
-    print "\t\t$extra\n" if defined $extra;
+        print "\t\t$extra\n" if defined $extra;
+    }
   }
 }
 
 sub conclude {
     my %missing_by_type = @_;
 
-    unless( keys %missing_by_type ) {
-        print "\nEverything was found.\n";
-        return;
-    }
+    unless ( $args{'list-deps'} ) {
+        unless ( keys %missing_by_type ) {
+            print "\nEverything was found.\n";
+            return;
+        }
 
-    print "\nSOME DEPENDENCIES WERE MISSING.\n";
+        print "\nSOME DEPENDENCIES WERE MISSING.\n";
 
-    for my $type (keys %missing_by_type) {
-        my $missing =  $missing_by_type{$type};
+        for my $type ( keys %missing_by_type ) {
+            my $missing = $missing_by_type{$type};
 
-        print "$type missing dependencies:\n";
-        for my $name (keys %$missing) {
-            my $module  = $missing->{$name};
-            my $version = $module->{version};
-            print_found($name . ( $version ? " >= $version" : "" ), 0, $module->{error});
+            print "$type missing dependencies:\n";
+            for my $name ( keys %$missing ) {
+                my $module  = $missing->{$name};
+                my $version = $module->{version};
+                print_found( $name . ( $version ? " >= $version" : "" ),
+                    0, $module->{error} );
+            }
         }
     }
 }
@@ -360,15 +367,21 @@
     my $module = shift;
     my $version = shift;
 
-    eval "use $module $version ()";
-    if ($@) {
-        my $error = $@;
-        $error =~ s/\n(.*)$//s;
-        undef $error unless $error =~ /this is only/;
+    if ( $args{'list-deps'} ) {
+        print $module, ': ', $version || 0, "\n"; 
+    }
+    else {
+        eval "use $module $version ()";
+        if ($@) {
+            my $error = $@;
+            $error =~ s/\n(.*)$//s;
+            undef $error unless $error =~ /this is only/;
 
-        return(0, $error);
-    } else {
-        return 1;
+            return ( 0, $error );
+        }
+        else {
+            return 1;
+        }
     }
 }
 


More information about the Rt-commit mailing list