From: Sam H. v. a. <we...@ma...> - 2007-10-22 20:40:49
|
Log Message: ----------- actually do the file copies, added --pretend and --verbose options. Modified Files: -------------- webwork2/bin: pg-pull Revision Data ------------- Index: pg-pull =================================================================== RCS file: /webwork/cvs/system/webwork2/bin/pg-pull,v retrieving revision 1.2 retrieving revision 1.3 diff -Lbin/pg-pull -Lbin/pg-pull -u -r1.2 -r1.3 --- bin/pg-pull +++ bin/pg-pull @@ -34,6 +34,7 @@ use Data::Dumper; use File::Path; use File::Spec; +use File::Copy; use Getopt::Long; use IO::File; @@ -109,7 +110,6 @@ sub process_file { my $file = shift; - print "$file\n"; # ignoring volume here because we don't care about w32 (undef, my ($dir, $name)) = File::Spec->splitpath($file); @@ -133,12 +133,14 @@ my @files = ($target_name); push @files, @{$tags{UsesAuxiliaryFiles}} if defined $tags{UsesAuxiliaryFiles}; - mkpath($target_dir); + #print "mkpath $target_dir\n" if $o{pretend} or $o{verbose}; + mkpath($target_dir) unless $o{pretend}; + foreach my $curr (@files) { my $src = File::Spec->catpath(undef, $dir, $curr); my $dest = File::Spec->catpath(undef, $target_dir, $curr); - print "$src => $dest\n"; - #copy($src, $dest); + print "copy $src $dest\n" if $o{pretend} or $o{verbose}; + copy($src, $dest) unless $o{pretend}; } } @@ -260,5 +262,7 @@ 'src-lib=s', 'stdin', 'suffix=s', + 'pretend', + 'verbose' ); main(@ARGV); |