[Bps-public-commit] Module-Install-RTx branch, master, updated. 0.34-1-g75b39f0

Wallace Reis wreis at bestpractical.com
Thu Jun 12 12:17:07 EDT 2014


The branch, master has been updated
       via  75b39f04bce402104c1c90605272380f5d09a272 (commit)
      from  0d29b0b71552a02c41e32417b0b67b7a188dc4cf (commit)

Summary of changes:
 lib/Module/Install/RTx.pm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

- Log -----------------------------------------------------------------
commit 75b39f04bce402104c1c90605272380f5d09a272
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Thu Jun 12 13:14:01 2014 -0300

    Create requires_rt_plugin helper
    
    It's usual that requires() doesn't pick up RT plugins, since they're not in
    @INC. This helper aims to shove the local/plugins/$name/lib subdir into @INC
    and then fallbacks to requires().

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 1931d1c..f4d9a0b 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -195,6 +195,19 @@ sub requires_rt {
     }
 }
 
+sub requires_rt_plugin {
+    my $self = shift;
+    my ( $plugin ) = @_;
+    $plugin =~ s{\:\:}{-}g;
+    my $path_to_pluginlib = $RT::LocalPluginPath
+        || $RT::LocalPath . '/plugins';
+       $path_to_pluginlib .= '/' . $plugin . '/lib';
+    if ( -e $path_to_pluginlib ) {
+        unshift @INC, $path_to_pluginlib;
+    }
+    $self->requires(@_);
+}
+
 sub rt_too_new {
     my ($self,$version,$msg) = @_;
     $msg ||= "Your version %s is too new, this extension requires a release of RT older than %s\n";
@@ -287,6 +300,11 @@ This module also provides the following helper functions
 Takes one argument, a valid RT version. If an attempt is made to install
 on an older RT, it will die before Makefile creation.
 
+=head2 requires_rt_plugin
+
+Takes same args as C<requires> and then fallbacks to that after mangling
+C<@INC> to include local plugin dirs.
+
 =head2 rt_too_new
 
 Takes an RT version and prevents this module from being installed on any

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


More information about the Bps-public-commit mailing list