[Bps-public-commit] app-moduleshere branch, master, updated. 94bc686cb4588187ded7354b7db5a5e7488fce43

? sunnavy sunnavy at bestpractical.com
Mon Sep 27 23:23:20 EDT 2010


The branch, master has been updated
       via  94bc686cb4588187ded7354b7db5a5e7488fce43 (commit)
      from  9a7be7ee496153bc54bea02f8f79a9307d52dfc1 (commit)

Summary of changes:
 Changes                |    4 ++++
 bin/mhere              |   15 ++++++++++++---
 dist.ini               |    5 ++++-
 lib/App/moduleshere.pm |    2 +-
 t/01.mhere.t           |   36 ++++++++++++++++++------------------
 5 files changed, 39 insertions(+), 23 deletions(-)

- Log -----------------------------------------------------------------
commit 94bc686cb4588187ded7354b7db5a5e7488fce43
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 28 09:20:51 2010 +0800

    code tweak and release 0.07

diff --git a/Changes b/Changes
index 4994792..cf7a073 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@ Revision history for App-moduleshere
 
 {{$NEXT}}
 
+0.07   2010-09-28 09:20:17 CST
+
+    code tweak
+
 0.06   2010-09-27 19:28:21 CST
 
     Add -r cmd option to copy modules and modules under them, e.g. 
diff --git a/bin/mhere b/bin/mhere
index a170152..c203f15 100755
--- a/bin/mhere
+++ b/bin/mhere
@@ -4,8 +4,6 @@ use warnings;
 use File::Spec::Functions qw/catdir catfile rel2abs splitpath/;
 use File::Path 'mkpath';
 use File::Copy qw/copy/;
-use File::Copy::Recursive 'rcopy';
-$File::Copy::Recursive::KeepMode = 0;
 
 use Getopt::Long;
 my %args;
@@ -35,6 +33,17 @@ if (@ARGV) {
         warn "failed to make path $to: it exists but not a directory\n";
     }
     else {
+        if ( $args{recursive} ) {
+            eval { require File::Copy::Recursive };
+            if ( $@ ) {
+                print
+"you need to install File::Copy::Recursive to use the -r flag\n";
+                exit;
+            }
+            no warnings 'once';
+            $File::Copy::Recursive::KeepMode = 0;
+        }
+
         for my $mod (@ARGV) {
             eval "require $mod" or warn "failed to require $mod\n" and next;
 
@@ -66,7 +75,7 @@ if (@ARGV) {
                 $dir =~ s/\.pm$//;
                 my $last_name = (splitpath $dir)[-1];
                 if ( -e $dir ) {
-                    rcopy( $dir, catdir( $here, $last_name ) )
+                    File::Copy::Recursive::dircopy( $dir, catdir( $here, $last_name ) )
                       or warn "failed to copy $dir to $here: $!\n" and next;
                 }
             }
diff --git a/dist.ini b/dist.ini
index 79311d0..e92b215 100644
--- a/dist.ini
+++ b/dist.ini
@@ -1,10 +1,13 @@
 name    = App-moduleshere
-version = 0.06
+version = 0.07
 author  = sunnavy <sunnavy at bestpractical.com>
 license = Perl_5
 copyright_holder = Best Practical Solutions 
 
 [@Basic]
+[Prereqs / RuntimeRecommends]
+File::Copy::Recursive = 0
+
 [NextRelease]
     format = %-6v %{yyyy-MM-dd HH:mm:ss VV}d
 [PodSyntaxTests]
diff --git a/lib/App/moduleshere.pm b/lib/App/moduleshere.pm
index 3893811..3f6ea7b 100644
--- a/lib/App/moduleshere.pm
+++ b/lib/App/moduleshere.pm
@@ -2,7 +2,7 @@ package App::moduleshere;
 
 use warnings;
 use strict;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 1;
 
diff --git a/t/01.mhere.t b/t/01.mhere.t
index fd29669..e29d319 100644
--- a/t/01.mhere.t
+++ b/t/01.mhere.t
@@ -6,7 +6,7 @@ use File::Temp 'tempdir';
 use FindBin;
 use File::Spec::Functions qw/catfile updir/;
 use Carp;
-my $mhere = catfile( $FindBin::Bin, updir, '/bin/mhere' );
+my $mhere = catfile( $FindBin::Bin, updir, 'bin', 'mhere' );
 
 my $dir = tempdir( CLEANUP => 1 );
 local $ENV{APP_MODULES_HERE} = $dir;
@@ -51,23 +51,23 @@ is(
     'mhere strict, File::Spec::Functions'
 );
 
-is(
-    `$^X $mhere Carp -r`,
-    'copied module(s): Carp' . "\n",
-    'mhere Carp'
-);
-
-compare_files(
-    $INC{'Carp.pm'},
-    catfile( $dir, 'Carp.pm' ),
-    'copied Carp.pm is indeed a copy'
-);
-
-compare_files(
-    $INC{'Carp/Heavy.pm'},
-    catfile( $dir, 'Carp', 'Heavy.pm' ),
-    'copied Carp/Heavy.pm is indeed a copy'
-);
+SKIP: {
+    eval { require File::Copy::Recursive };
+    skip 'need File::Copy::Recursive to use -r', 3 if $@;
+    is( `$^X $mhere Carp -r`, 'copied module(s): Carp' . "\n", 'mhere Carp' );
+
+    compare_files(
+        $INC{'Carp.pm'},
+        catfile( $dir, 'Carp.pm' ),
+        'copied Carp.pm is indeed a copy'
+    );
+
+    compare_files(
+        $INC{'Carp/Heavy.pm'},
+        catfile( $dir, 'Carp', 'Heavy.pm' ),
+        'copied Carp/Heavy.pm is indeed a copy'
+    );
+}
 
 
 # test if the source and the destination is the same file

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list