[Rt-commit] r13778 - in rt/3.8/trunk: .

spang at bestpractical.com spang at bestpractical.com
Thu Jul 3 15:35:14 EDT 2008


Author: spang
Date: Thu Jul  3 15:35:14 2008
New Revision: 13778

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Test.pm

Log:
 r43578 at loki:  spang | 2008-07-03 15:50:26 +0100
 add subroutines for converting test data paths into relocateable paths


Modified: rt/3.8/trunk/lib/RT/Test.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Test.pm	(original)
+++ rt/3.8/trunk/lib/RT/Test.pm	Thu Jul  3 15:35:14 2008
@@ -603,6 +603,21 @@
     return undef;
 }
 
+sub get_relocateable_dir {
+    # takes a path relative to the top-level test dir and retuns
+    # a path relative to the invocation path
+    (my $volume, my $directories, my $file) = File::Spec->splitpath($0);
+    return File::Spec->catdir( File::Spec->curdir(), $directories,
+        File::Spec->updir(), @_);
+}
+
+sub get_relocateable_file {
+    # same as get_relocateable_dir, but takes a file and a path instead
+    # of just a path
+    my $file = shift;
+    return File::Spec->catfile(get_relocateable_dir(@_), $file);
+}
+
 sub import_gnupg_key {
     my $self = shift;
     my $key = shift;
@@ -612,11 +627,8 @@
     $key .= ".$type.key";
 
     require RT::Crypt::GnuPG;
-    (my $volume, my $directories, my $file) = File::Spec->splitpath($0);
-    my $keys_dir = File::Spec->catdir( File::Spec->curdir(), $directories,
-        File::Spec->updir(), qw(data gnupg keys) );
     return RT::Crypt::GnuPG::ImportKey(
-        RT::Test->file_content([$keys_dir, $key])
+        RT::Test->file_content([get_relocateable_dir(qw(data gnupg keys)), $key])
     );
 }
 


More information about the Rt-commit mailing list