[Bps-public-commit] Module-Install-RTx branch, master, updated. 0.34-27-g1ba3229

Alex Vandiver alexmv at bestpractical.com
Thu Jun 19 16:21:25 EDT 2014


The branch, master has been updated
       via  1ba32290e42d208c441ae360d55ed3fa6b56bdde (commit)
       via  d7a3b424e1671d93fcc494b3ddc67d2312b54b01 (commit)
       via  b39602b3c83ef71b9fe83180c9dd70ac2b5cec86 (commit)
       via  d4b6d2c073aac0c3236a638c73e7652ee220a087 (commit)
       via  1cdb7bbaded0e834fd5b7510c8d3e6e723e33998 (commit)
       via  e9298946a6f081886665d4ca101cf09a7f496a7f (commit)
       via  3c07f87a882154f3a468b17a4b4d9cb3f2f2855e (commit)
       via  9a24cc54303ab7b0091c78280a56d9005af06f01 (commit)
       via  1b3727b8e76f20b66a4eefdcd50820b063c159c1 (commit)
       via  0f9b56fb2a742195e970060c55c8da7b86169d2e (commit)
       via  b230df8367b7c43641f764c725b88b0e1ca99683 (commit)
       via  a9aa2a1a2545cbc6754523ed11c87869fa9c65f9 (commit)
       via  50ac5f8dd1fb53470f977947a3b784a4fb093d9c (commit)
       via  89dd3480014d786bb83aafdd1f1f319fc5d6d049 (commit)
       via  212ed0dc589483cd35e02228b30f34607da38351 (commit)
       via  5a359cb2dd89b20f7d315e6a308b78f3aae17e0e (commit)
       via  074a0bb591815afc88c683b85aded4e78a98e30f (commit)
       via  2e2d58f3ca3dee5e71110fbd357ea15bac9599fb (commit)
       via  8f684c94b316b7e69c6b85017a481c5f4693f2b9 (commit)
       via  d0bb25a7c49dba2a3bfe3c7c45e931e81377873e (commit)
       via  fa3e7a9eb82ffb0abc3180bcfef099ad06faa736 (commit)
       via  bf6ce7c0c4b18663c3d93b7953bdf3345195b064 (commit)
       via  2872d0ef2ed7aac396564cc78b0b0cc77df53a05 (commit)
       via  8117d331151ac937ca463393bed4dde212f6ac52 (commit)
       via  01a913de1b76075be290be44bd28029c8a65f95f (commit)
       via  d0d9401e0056c96ab8fce2030a700610220ca406 (commit)
      from  75b39f04bce402104c1c90605272380f5d09a272 (commit)

Summary of changes:
 Changes                           | 224 +++++++++++++++-----------------
 MANIFEST                          |   2 +-
 META.yml                          |   8 +-
 README                            |  97 +++++---------
 lib/Module/Install/RTx.pm         | 266 +++++++++++++++++---------------------
 lib/Module/Install/RTx/Factory.pm |  52 --------
 lib/Module/Install/RTx/Runtime.pm |  76 +++++++++++
 7 files changed, 337 insertions(+), 388 deletions(-)
 delete mode 100644 lib/Module/Install/RTx/Factory.pm
 create mode 100644 lib/Module/Install/RTx/Runtime.pm

- Log -----------------------------------------------------------------
commit d0d9401e0056c96ab8fce2030a700610220ca406
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:56:35 2014 -0400

    All supported versions of RT include RT::LocalPluginPath

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index f4d9a0b..bbd42dd 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -198,12 +198,12 @@ 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;
+
+    my $path = $plugin;
+    $path =~ s{\:\:}{-}g;
+    $path = "RT::LocalPluginPath/$path/lib";
+    if ( -e $path ) {
+        unshift @INC, $path;
     }
     $self->requires(@_);
 }

commit 01a913de1b76075be290be44bd28029c8a65f95f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:57:01 2014 -0400

    Warn much more obviously on failure to find the expected directory

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index bbd42dd..7291947 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -204,6 +204,14 @@ sub requires_rt_plugin {
     $path = "RT::LocalPluginPath/$path/lib";
     if ( -e $path ) {
         unshift @INC, $path;
+    } else {
+        my $name = $self->name;
+        warn <<"EOT";
+
+**** Warning: $name requires that the $plugin plugin be installed and
+              enabled; it does not appear to be installed.
+
+EOT
     }
     $self->requires(@_);
 }

commit 8117d331151ac937ca463393bed4dde212f6ac52
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:42:16 2014 -0400

    Remove RT3-specific code

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 7291947..557e50a 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -43,7 +43,7 @@ sub RTx {
         local @INC = (
             $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
             @INC,
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
+            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" )
                 } grep $_, @prefixes
         );
         until ( eval { require RT; $RT::LocalPath } ) {
@@ -51,7 +51,7 @@ sub RTx {
                 "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n";
             $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
             $_ =~ s/\/RT\.pm$//;
-            push @INC, $_, "$_/rt3/lib", "$_/lib/rt3", "$_/lib";
+            push @INC, $_, "$_/rt4/lib", "$_/lib/rt4", "$_/lib";
         }
     }
 
@@ -78,29 +78,15 @@ sub RTx {
         $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
     }
 
-    # If we're running on RT 3.8 with plugin support, we really wany
-    # to install libs, mason templates and po files into plugin specific
-    # directories
+    # Installation locations
     my %path;
-    if ( $RT::LocalPluginPath ) {
-        die "Because of bugs in RT 3.8.0 this extension can not be installed.\n"
-            ."Upgrade to RT 3.8.1 or newer.\n" if $RT::VERSION =~ /^3\.8\.0/;
-        $path{$_} = $RT::LocalPluginPath . "/$original_name/$_"
-            foreach @DIRS;
-
-        # Copy RT 4.2.0 static files into NoAuth; insufficient for
-        # images, but good enough for css and js.
-        $path{static} = "$path{html}/NoAuth/"
-            unless $RT::StaticPath;
-    } else {
-        foreach ( @DIRS ) {
-            no strict 'refs';
-            my $varname = "RT::Local" . ucfirst($_) . "Path";
-            $path{$_} = ${$varname} || "$RT::LocalPath/$_";
-        }
+    $path{$_} = $RT::LocalPluginPath . "/$name/$_"
+        foreach @DIRS;
 
-        $path{$_} .= "/$name" for grep $path{$_}, qw(etc po var);
-    }
+    # Copy RT 4.2.0 static files into NoAuth; insufficient for
+    # images, but good enough for css and js.
+    $path{static} = "$path{html}/NoAuth/"
+        unless $RT::StaticPath;
 
     my %index = map { $_ => 1 } @INDEX_DIRS;
     $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
@@ -332,13 +318,6 @@ implemented in this installer to support RTx('Foo') for 'RTx-Foo' extension, but
 life proved that it's bad idea. Code still there for backwards compatibility.
 It will be deleted eventually.
 
-=item * installer won't work with RT 3.8.0, as it has some bugs new plugins
-sub-system.
-
-=item * layout of files has been changed between RT 3.6 and RT 3.8, old files
-may influence behaviour of your extension. Recommend people use clean dir on
-upgrade or guide how to remove old versions of your extension.
-
 =back
 
 =head1 ENVIRONMENT

commit 2872d0ef2ed7aac396564cc78b0b0cc77df53a05
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:42:56 2014 -0400

    Set a default lower bound of 4.0.0

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 557e50a..135129f 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -164,6 +164,8 @@ install ::
             $self->postamble("upgradedb ::\n$upgradedb\n");
         }
     }
+
+    $self->requires_rt('4.0.0');
 }
 
 sub requires_rt {

commit bf6ce7c0c4b18663c3d93b7953bdf3345195b064
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:47:44 2014 -0400

    Update documentation on file placement
    
    The paths described are the paths before local/plugins/ existed.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 135129f..30a4b55 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -241,44 +241,34 @@ Module::Install::RTx - RT extension installer
 
 =head1 SYNOPSIS
 
-In the F<Makefile.PL> of the C<RT-Extension-Foo> module:
+In the F<Makefile.PL> of the C<RT-Extension-Example> module:
 
     use inc::Module::Install;
-    RTx 'RT-Extension-Foo';
-    WriteAll();
-
-optionally add a
+    RTx 'RT-Extension-Example';
 
-    requires_rt('3.8.9');
+    requires_rt '4.2.0';
+    rt_too_new  '4.4.0';
 
-to die if your RT version is too old during install
+    WriteAll();
 
 =head1 DESCRIPTION
 
-This B<Module::Install> extension implements a function, C<RTx>,
-that takes the extension name as the only argument.
+This B<Module::Install> extension implements several functions for
+installing RT extensions:
 
-It arranges for certain subdirectories to install into the installed
-RT location, but does not affect the usual C<lib> and C<t> directories.
+=head2 RTx 'I<extension name>'
 
-The directory mapping table is as below:
+This function arranges for the following directories to be installed, if
+they exist (assuming C<RTx('RT-Extension-Example')>):
 
-    ./bin   => $RT::LocalPath/bin
-    ./etc   => $RT::LocalPath/etc/$NAME
-    ./html  => $RT::MasonComponentRoot
-    ./po    => $RT::LocalLexiconPath/$NAME
-    ./sbin  => $RT::LocalPath/sbin
-    ./var   => $RT::VarPath/$NAME
-
-Under the default RT3 layout in F</opt> and with the extension name
-C<Foo>, it becomes:
-
-    ./bin   => /opt/rt3/local/bin
-    ./etc   => /opt/rt3/local/etc/Foo
-    ./html  => /opt/rt3/share/html
-    ./po    => /opt/rt3/local/po/Foo
-    ./sbin  => /opt/rt3/local/sbin
-    ./var   => /opt/rt3/var/Foo
+    ./bin    => $RT::LocalPluginPath/RT-Extension-Example/bin
+    ./etc    => $RT::LocalPluginPath/RT-Extension-Example/etc
+    ./html   => $RT::LocalPluginPath/RT-Extension-Example/html
+    ./lib    => $RT::LocalPluginPath/RT-Extension-Example/lib
+    ./po     => $RT::LocalPluginPath/RT-Extension-Example/po
+    ./sbin   => $RT::LocalPluginPath/RT-Extension-Example/sbin
+    ./static => $RT::LocalPluginPath/RT-Extension-Example/static
+    ./var    => $RT::LocalPluginPath/RT-Extension-Example/var
 
 By default, all these subdirectories will be installed with C<make install>.
 you can override this by setting the C<WITH_SUBDIRS> environment variable to
@@ -289,23 +279,23 @@ C<Makefile.PL>, like this:
 
     perl Makefile.PL WITH_SUBDIRS=sbin
 
-This module also provides the following helper functions
-
-=head2 requires_rt
+=head2 requires_rt I<version>
 
 Takes one argument, a valid RT version. If an attempt is made to install
-on an older RT, it will die before Makefile creation.
+on an RT than that version, it will die before Makefile creation.
 
-=head2 requires_rt_plugin
+=head2 requires_rt_plugin I<RT::Extension::Example> [, I<version>]
 
-Takes same args as C<requires> and then fallbacks to that after mangling
-C<@INC> to include local plugin dirs.
+Ensures that the given RT extension (and optional version) is installed
+in the target RT instance; C<requires> cannot be used because RT
+extensions are not in @INC.
 
-=head2 rt_too_new
+=head2 rt_too_new I<version> [, I<message>]
 
-Takes an RT version and prevents this module from being installed on any
-version of RT equal to or newer than that.  Useful if a particular release of an
-extension only works on 4.0.x but not 4.2.x.
+Takes one argument, a valid RT version, and prevents this module from
+being installed on any version of RT equal to or newer than that.
+Useful if a particular release of an extension only works on 4.0.x but
+not 4.2.x.
 
 Takes an optional second argument which allows you to specify a custom
 error message. This message is passed to sprintf with two string

commit fa3e7a9eb82ffb0abc3180bcfef099ad06faa736
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:49:08 2014 -0400

    Be more forgiving of entered path to RT.pm, stripping off final /lib if need be

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 30a4b55..718f6f4 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -50,7 +50,7 @@ sub RTx {
             warn
                 "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n";
             $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
-            $_ =~ s/\/RT\.pm$//;
+            $_ =~ s{(/lib)?/RT\.pm$}{};
             push @INC, $_, "$_/rt4/lib", "$_/lib/rt4", "$_/lib";
         }
     }

commit d0bb25a7c49dba2a3bfe3c7c45e931e81377873e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:50:32 2014 -0400

    Don't grow @INC with each failed guess at $ENV{RTHOME}

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 718f6f4..5d54f22 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -32,7 +32,7 @@ sub RTx {
     $self->abstract("RT $name Extension")
         unless $self->abstract;
 
-    my @prefixes = (qw(/opt /usr/local /home /usr /sw ));
+    # Try to find RT.pm -- if they give a PREFIX, just use that
     my $prefix   = $ENV{PREFIX};
     @ARGV = grep { /PREFIX=(.*)/ ? ( ( $prefix = $1 ), 0 ) : 1 } @ARGV;
 
@@ -40,18 +40,20 @@ sub RTx {
         $RT::LocalPath = $prefix;
         $INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm";
     } else {
-        local @INC = (
-            $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
-            @INC,
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" )
-                } grep $_, @prefixes
-        );
-        until ( eval { require RT; $RT::LocalPath } ) {
+        my @prefixes = qw( /opt /usr/local /home /usr /sw );
+        my @try = $ENV{RTHOME} ? ($ENV{RTHOME}, "$ENV{RTHOME}/lib") : ();
+        while (1) {
+            my @look = @INC;
+            unshift @look, grep {defined and -d $_} @try;
+            push @look, grep {defined and -d $_}
+                map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+            last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
+
             warn
-                "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n";
+                "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @look\n";
             $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
             $_ =~ s{(/lib)?/RT\.pm$}{};
-            push @INC, $_, "$_/rt4/lib", "$_/lib/rt4", "$_/lib";
+            @try = ("$_/rt4/lib", "$_/lib/rt4", "$_/lib");
         }
     }
 

commit 8f684c94b316b7e69c6b85017a481c5f4693f2b9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:53:25 2014 -0400

    Remove misleading and useless defaults
    
    On all supported RT versions (4.0.0 and up), the valid variables
    (LocalLibPath, LocaltaticPath) are already defined in RT/Generated.pm.
    The other variables are unused and unsupported.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 5d54f22..43b635c 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -63,12 +63,6 @@ sub RTx {
     unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
     unshift @INC, $lib_path;
 
-    $RT::LocalVarPath    ||= $RT::VarPath;
-    $RT::LocalPoPath     ||= $RT::LocalLexiconPath;
-    $RT::LocalHtmlPath   ||= $RT::MasonComponentRoot;
-    $RT::LocalStaticPath ||= $RT::StaticPath;
-    $RT::LocalLibPath    ||= "$RT::LocalPath/lib";
-
     my $with_subdirs = $ENV{WITH_SUBDIRS};
     @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
         @ARGV;

commit 2e2d58f3ca3dee5e71110fbd357ea15bac9599fb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:56:02 2014 -0400

    Remove support for WITH_SUBDIRS
    
    I have never seen this functionality used, and its premise (of
    installing _part_ of a module) seems dubious at best.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 43b635c..fb3dc2b 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -57,22 +57,15 @@ sub RTx {
         }
     }
 
-    my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
-    my $local_lib_path = "$RT::LocalPath/lib";
     print "Using RT configuration from $INC{'RT.pm'}:\n";
-    unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
-    unshift @INC, $lib_path;
 
-    my $with_subdirs = $ENV{WITH_SUBDIRS};
-    @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
-        @ARGV;
+    my $local_lib_path = $RT::LocalLibPath;
+    unshift @INC, $local_lib_path;
+    my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
+    unshift @INC, $lib_path;
 
     my %subdirs;
-    %subdirs = map { $_ => 1 } split( /\s*,\s*/, $with_subdirs )
-        if defined $with_subdirs;
-    unless ( keys %subdirs ) {
-        $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
-    }
+    $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
 
     # Installation locations
     my %path;
@@ -266,15 +259,6 @@ they exist (assuming C<RTx('RT-Extension-Example')>):
     ./static => $RT::LocalPluginPath/RT-Extension-Example/static
     ./var    => $RT::LocalPluginPath/RT-Extension-Example/var
 
-By default, all these subdirectories will be installed with C<make install>.
-you can override this by setting the C<WITH_SUBDIRS> environment variable to
-a comma-delimited subdirectory list, such as C<html,sbin>.
-
-Alternatively, you can also specify the list as a command-line option to
-C<Makefile.PL>, like this:
-
-    perl Makefile.PL WITH_SUBDIRS=sbin
-
 =head2 requires_rt I<version>
 
 Takes one argument, a valid RT version. If an attempt is made to install

commit 074a0bb591815afc88c683b85aded4e78a98e30f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 14:06:31 2014 -0400

    Remove PREFIX support; it does not load RT.pm, and as such fails in _load_rt_handle

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index fb3dc2b..5a04202 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -32,29 +32,21 @@ sub RTx {
     $self->abstract("RT $name Extension")
         unless $self->abstract;
 
-    # Try to find RT.pm -- if they give a PREFIX, just use that
-    my $prefix   = $ENV{PREFIX};
-    @ARGV = grep { /PREFIX=(.*)/ ? ( ( $prefix = $1 ), 0 ) : 1 } @ARGV;
-
-    if ($prefix) {
-        $RT::LocalPath = $prefix;
-        $INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm";
-    } else {
-        my @prefixes = qw( /opt /usr/local /home /usr /sw );
-        my @try = $ENV{RTHOME} ? ($ENV{RTHOME}, "$ENV{RTHOME}/lib") : ();
-        while (1) {
-            my @look = @INC;
-            unshift @look, grep {defined and -d $_} @try;
-            push @look, grep {defined and -d $_}
-                map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
-            last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
-
-            warn
-                "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @look\n";
-            $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
-            $_ =~ s{(/lib)?/RT\.pm$}{};
-            @try = ("$_/rt4/lib", "$_/lib/rt4", "$_/lib");
-        }
+    # Try to find RT.pm
+    my @prefixes = qw( /opt /usr/local /home /usr /sw );
+    my @try = $ENV{RTHOME} ? ($ENV{RTHOME}, "$ENV{RTHOME}/lib") : ();
+    while (1) {
+        my @look = @INC;
+        unshift @look, grep {defined and -d $_} @try;
+        push @look, grep {defined and -d $_}
+            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+        last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
+
+        warn
+            "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @look\n";
+        $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
+        $_ =~ s{(/lib)?/RT\.pm$}{};
+        @try = ("$_/rt4/lib", "$_/lib/rt4", "$_/lib");
     }
 
     print "Using RT configuration from $INC{'RT.pm'}:\n";

commit 5a359cb2dd89b20f7d315e6a308b78f3aae17e0e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:57:26 2014 -0400

    Unify %path and %subdirs logic

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 5a04202..1a2ff5a 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -56,9 +56,6 @@ sub RTx {
     my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
     unshift @INC, $lib_path;
 
-    my %subdirs;
-    $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
-
     # Installation locations
     my %path;
     $path{$_} = $RT::LocalPluginPath . "/$name/$_"
@@ -69,15 +66,18 @@ sub RTx {
     $path{static} = "$path{html}/NoAuth/"
         unless $RT::StaticPath;
 
+    # Delete the ones we don't need
+    delete $path{$_} for grep {not -d "$FindBin::Bin/$_"} keys %path;
+
     my %index = map { $_ => 1 } @INDEX_DIRS;
     $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
 
     my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
-        grep $subdirs{$_}, keys %path;
+        sort keys %path;
 
-    print "./$_\t=> $path{$_}\n" for sort keys %subdirs;
+    printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
 
-    if ( my @dirs = map { ( -D => $_ ) } grep $subdirs{$_}, qw(bin html sbin) ) {
+    if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin) ) {
         my @po = map { ( -o => $_ ) }
             grep -f,
             File::Glob::bsd_glob("po/*.po");
@@ -92,7 +92,7 @@ install ::
 \t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\"
 .
 
-    if ( $subdirs{var} and -d $RT::MasonDataDir ) {
+    if ( $path{var} and -d $RT::MasonDataDir ) {
         my ( $uid, $gid ) = ( stat($RT::MasonDataDir) )[ 4, 5 ];
         $postamble .= << ".";
 \t\$(NOECHO) chown -R $uid:$gid $path{var}
@@ -112,11 +112,11 @@ install ::
     }
 
     $self->postamble("$postamble\n");
-    unless ( $subdirs{'lib'} ) {
-        $self->makemaker_args( PM => { "" => "" }, );
-    } else {
+    if ( $path{lib} ) {
         $self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
         $self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
+    } else {
+        $self->makemaker_args( PM => { "" => "" }, );
     }
 
     $self->makemaker_args( INSTALLSITEMAN1DIR => "$RT::LocalPath/man/man1" );

commit 212ed0dc589483cd35e02228b30f34607da38351
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:58:48 2014 -0400

    Enforce that RTx must be provided full extension name
    
    Nearly 4 years is sufficient of a deprecation cycle.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 1a2ff5a..98df4ff 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -19,17 +19,15 @@ my @INDEX_DIRS = qw(lib bin sbin);
 sub RTx {
     my ( $self, $name ) = @_;
 
-    my $original_name = $name;
-    my $RTx = 'RTx';
-    $RTx = $1 if $name =~ s/^(\w+)-//;
+    # Set up names
     my $fname = $name;
     $fname =~ s!-!/!g;
 
-    $self->name("$RTx-$name")
+    $self->name( $name )
         unless $self->name;
-    $self->all_from( -e "$name.pm" ? "$name.pm" : "lib/$RTx/$fname.pm" )
+    $self->all_from( "lib/$fname.pm" )
         unless $self->version;
-    $self->abstract("RT $name Extension")
+    $self->abstract("$name Extension")
         unless $self->abstract;
 
     # Try to find RT.pm
@@ -277,10 +275,10 @@ arguments, the current RT version and the version you specify.
 
 =over 4
 
-=item * Use full name when call RTx method in Makefile.PL, some magic has been
-implemented in this installer to support RTx('Foo') for 'RTx-Foo' extension, but
-life proved that it's bad idea. Code still there for backwards compatibility.
-It will be deleted eventually.
+=item *
+
+Us the full name when calling RTx method in Makefile.PL; while
+C<RTx('Foo')> was once supported, it is no longer.
 
 =back
 

commit 89dd3480014d786bb83aafdd1f1f319fc5d6d049
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 11:59:16 2014 -0400

    etc can have locstrings to extract, as well

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 98df4ff..a667132 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -75,7 +75,7 @@ sub RTx {
 
     printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
 
-    if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin) ) {
+    if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin etc) ) {
         my @po = map { ( -o => $_ ) }
             grep -f,
             File::Glob::bsd_glob("po/*.po");

commit 50ac5f8dd1fb53470f977947a3b784a4fb093d9c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 12:00:00 2014 -0400

    Add metadata to META.yml for minimum and maximum supported RT versions

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index a667132..cf96a00 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -150,6 +150,8 @@ install ::
 sub requires_rt {
     my ($self,$version) = @_;
 
+    $self->add_metadata("x_requires_rt", $version) if $self->is_admin;
+
     # if we're exactly the same version as what we want, silently return
     return if ($version eq $RT::VERSION);
 
@@ -166,6 +168,12 @@ sub requires_rt_plugin {
     my $self = shift;
     my ( $plugin ) = @_;
 
+    if ($self->is_admin) {
+        my $plugins = $self->{values}{"x_requires_rt_plugins"} || [];
+        push @{$plugins}, $plugin;
+        $self->add_metadata("x_requires_rt_plugins", $plugins);
+    }
+
     my $path = $plugin;
     $path =~ s{\:\:}{-}g;
     $path = "RT::LocalPluginPath/$path/lib";
@@ -187,6 +195,8 @@ 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";
 
+    $self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
+
     _load_rt_handle();
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 

commit a9aa2a1a2545cbc6754523ed11c87869fa9c65f9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 13:13:38 2014 -0400

    Set a minimum perl version based on the minimum RT version

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index cf96a00..b6f26da 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -150,12 +150,21 @@ install ::
 sub requires_rt {
     my ($self,$version) = @_;
 
-    $self->add_metadata("x_requires_rt", $version) if $self->is_admin;
+    _load_rt_handle();
+
+    if ($self->is_admin) {
+        $self->add_metadata("x_requires_rt", $version);
+        my @sorted = sort RT::Handle::cmp_version $version,'4.0.0';
+        $self->perl_version('5.008003') if $sorted[0] eq '4.0.0'
+            and (not $self->perl_version or '5.008003' > $self->perl_version);
+        @sorted = sort RT::Handle::cmp_version $version,'4.2.0';
+        $self->perl_version('5.010001') if $sorted[0] eq '4.2.0'
+            and (not $self->perl_version or '5.010001' > $self->perl_version);
+    }
 
     # if we're exactly the same version as what we want, silently return
     return if ($version eq $RT::VERSION);
 
-    _load_rt_handle();
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {

commit b230df8367b7c43641f764c725b88b0e1ca99683
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 01:26:21 2014 -0400

    Rename Module::Install::RTx::Factory to a more appropriate name

diff --git a/MANIFEST b/MANIFEST
index b88bf6c..2734a18 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -6,7 +6,7 @@ inc/Module/Install/Metadata.pm
 inc/Module/Install/ReadmeFromPod.pm
 inc/Module/Install/WriteAll.pm
 lib/Module/Install/RTx.pm
-lib/Module/Install/RTx/Factory.pm
+lib/Module/Install/RTx/Runtime.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml
diff --git a/META.yml b/META.yml
index ee22134..06827f3 100644
--- a/META.yml
+++ b/META.yml
@@ -22,8 +22,8 @@ provides:
   Module::Install::RTx:
     file: lib/Module/Install/RTx.pm
     version: 0.34
-  Module::Install::RTx::Factory:
-    file: lib/Module/Install/RTx/Factory.pm
+  Module::Install::RTx::Runtime:
+    file: lib/Module/Install/RTx/Runtime.pm
 requires:
   Module::Install::Admin: 0.4
   perl: 5.8.0
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index b6f26da..04f1558 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -122,23 +122,23 @@ install ::
     $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
 
     if (%has_etc) {
-        $self->load('RTxInitDB');
+        $self->load('RTxDatabase');
         print "For first-time installation, type 'make initdb'.\n";
         my $initdb = '';
         $initdb .= <<"." if $has_etc{schema};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxDatabase(qw(schema \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{acl};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxDatabase(qw(acl \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{initialdata};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxDatabase(qw(insert \$(NAME) \$(VERSION)))"
 .
         $self->postamble("initdb ::\n$initdb\n");
         $self->postamble("initialize-database ::\n$initdb\n");
         if ($has_etc{upgrade}) {
             print "To upgrade from a previous version of this extension, use 'make upgrade-database'\n";
-            my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(upgrade \$(NAME) \$(VERSION)))"\n|;
+            my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxDatabase(qw(upgrade \$(NAME) \$(VERSION)))"\n|;
             $self->postamble("upgrade-database ::\n$upgradedb\n");
             $self->postamble("upgradedb ::\n$upgradedb\n");
         }
diff --git a/lib/Module/Install/RTx/Factory.pm b/lib/Module/Install/RTx/Runtime.pm
similarity index 96%
rename from lib/Module/Install/RTx/Factory.pm
rename to lib/Module/Install/RTx/Runtime.pm
index 1ad8c8d..9d0ff31 100644
--- a/lib/Module/Install/RTx/Factory.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -1,10 +1,10 @@
-package Module::Install::RTx::Factory;
+package Module::Install::RTx::Runtime;
 use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
 use strict;
 use File::Basename ();
 
-sub RTxInitDB {
+sub RTxDatabase {
     my ($self, $action, $name, $version) = @_;
 
     unshift @INC, substr(delete($INC{'RT.pm'}), 0, -5) if $INC{'RT.pm'};

commit 0f9b56fb2a742195e970060c55c8da7b86169d2e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 01:28:59 2014 -0400

    No need to adjust @INC; callsites for RTxDatabase pass in appropriate -I values

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index 9d0ff31..a639b12 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -7,10 +7,7 @@ use File::Basename ();
 sub RTxDatabase {
     my ($self, $action, $name, $version) = @_;
 
-    unshift @INC, substr(delete($INC{'RT.pm'}), 0, -5) if $INC{'RT.pm'};
-
     require RT;
-    unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
 
     $RT::SbinPath ||= $RT::LocalPath;
     $RT::SbinPath =~ s/local$/sbin/;

commit 1b3727b8e76f20b66a4eefdcd50820b063c159c1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 01:29:23 2014 -0400

    $RT::SbinPath is set in all supported versions of RT

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index a639b12..6d84172 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -9,9 +9,6 @@ sub RTxDatabase {
 
     require RT;
 
-    $RT::SbinPath ||= $RT::LocalPath;
-    $RT::SbinPath =~ s/local$/sbin/;
-
     foreach my $file ($RT::CORE_CONFIG_FILE, $RT::SITE_CONFIG_FILE) {
         next if !-e $file or -r $file;
         die "No permission to read $file\n-- please re-run $0 with suitable privileges.\n";

commit 9a24cc54303ab7b0091c78280a56d9005af06f01
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 01:38:03 2014 -0400

    Remove references to non-existant variables
    
    $RT::CORE_CONFIG_FILE and $RT::SITE_CONFIG_FILE were removed in
    96411640, and thus this section of code has been a no-op since 3.7.1.
    
    RT::LoadConfig will die if it cannot load RT_Config.pm, although the
    message is somewhat misleading, as it refers to "the user/group your
    webserver is running as" which is irrelevant in this context.

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index 6d84172..316780d 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -9,11 +9,6 @@ sub RTxDatabase {
 
     require RT;
 
-    foreach my $file ($RT::CORE_CONFIG_FILE, $RT::SITE_CONFIG_FILE) {
-        next if !-e $file or -r $file;
-        die "No permission to read $file\n-- please re-run $0 with suitable privileges.\n";
-    }
-
     RT::LoadConfig();
 
     require RT::System;

commit 3c07f87a882154f3a468b17a4b4d9cb3f2f2855e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:03:24 2014 -0400

    Intercept permission-denied messages and adjust them
    
    While matching on the error using regexes is somewhat fragile, all
    supported versions do currently use the same phrasing.  Attempting to
    replicate the entire logic of RT::Config->LoadConfig in order to
    re-check permissions seems like too high a cost for the rather low
    chance that we re-word these messages in a stable series -- regardless,
    the failure mode is no worse than at present: a misleading warning.

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index 316780d..ab8ce9e 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -9,7 +9,17 @@ sub RTxDatabase {
 
     require RT;
 
-    RT::LoadConfig();
+    eval { RT::LoadConfig(); };
+    if (my $err = $@) {
+        die $err unless $err =~ /^RT couldn't load RT config file/m;
+        my $warn = <<EOT;
+This usually means that your current user cannot read the file.  You
+will likely need to run this installation step as root, or some user
+with more permissions.
+EOT
+        $err =~ s/This usually means.*/$warn/s;
+        die $err;
+    }
 
     require RT::System;
 

commit e9298946a6f081886665d4ca101cf09a7f496a7f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:13:00 2014 -0400

    Use $RT:LocalLibPath, instead of assuming based on $RT::LocalPath

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index ab8ce9e..37fd57f 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -24,9 +24,9 @@ EOT
     require RT::System;
 
     my $lib_path = File::Basename::dirname($INC{'RT.pm'});
-    my @args = ("-Ilib");
-    push @args, "-I$RT::LocalPath/lib" if $RT::LocalPath;
-    push @args, (
+    my @args = (
+        "-Ilib",
+        "-I$RT::LocalLibPath",
         "-I$lib_path",
         "$RT::SbinPath/rt-setup-database",
         "--action"      => $action,

commit 1cdb7bbaded0e834fd5b7510c8d3e6e723e33998
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:57:43 2014 -0400

    Move the uses of RT::System closer to the require, to make its purpose clearer

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index 37fd57f..6bab237 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -22,6 +22,7 @@ EOT
     }
 
     require RT::System;
+    my $has_upgrade = RT::System->can('AddUpgradeHistory');
 
     my $lib_path = File::Basename::dirname($INC{'RT.pm'});
     my @args = (
@@ -34,13 +35,12 @@ EOT
         (($action eq 'insert') ? ("--datafile"    => "etc/initialdata") : ()),
         "--dba"         => $RT::DatabaseAdmin || $RT::DatabaseUser,
         "--prompt-for-dba-password" => '',
-        (RT::System->can('AddUpgradeHistory') ? ("--package" => $name, "--ext-version" => $version) : ()),
+        ($has_upgrade ? ("--package" => $name, "--ext-version" => $version) : ()),
     );
     # If we're upgrading against an RT which isn't at least 4.2 (has
     # AddUpgradeHistory) then pass --package.  Upgrades against later RT
     # releases will pick up --package from AddUpgradeHistory.
-    if ($action eq 'upgrade' and
-        not RT::System->can('AddUpgradeHistory')) {
+    if ($action eq 'upgrade' and not $has_upgrade) {
         push @args, "--package" => $name;
     }
 

commit d4b6d2c073aac0c3236a638c73e7652ee220a087
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 02:58:25 2014 -0400

    Refactor runtime loading of RT config

diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index 6bab237..d308016 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -4,9 +4,7 @@ use Module::Install::Base; @ISA = qw(Module::Install::Base);
 use strict;
 use File::Basename ();
 
-sub RTxDatabase {
-    my ($self, $action, $name, $version) = @_;
-
+sub _rt_runtime_load {
     require RT;
 
     eval { RT::LoadConfig(); };
@@ -20,6 +18,12 @@ EOT
         $err =~ s/This usually means.*/$warn/s;
         die $err;
     }
+}
+
+sub RTxDatabase {
+    my ($self, $action, $name, $version) = @_;
+
+    $self->_rt_runtime_load;
 
     require RT::System;
     my $has_upgrade = RT::System->can('AddUpgradeHistory');

commit b39602b3c83ef71b9fe83180c9dd70ac2b5cec86
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 15:49:52 2014 -0400

    Check @Plugins for prereqs at "make install" time
    
    We cannot check @Plugins earlier, such as during "perl Makefile.PL"
    time, because of permissions.  "make install", however, does have
    permissions to read the RT_Config file.  The set of prereqs cannot be
    hardcoded into the call in the Makefile because they are not known yet;
    only calls to rt_requires_plugin() after the RTx() call will set them
    up.  Thus the only source of the RT plugin prereqs is in the META.yml
    file; load it and to check that all of the explicit dependencies are
    enabled.  This mirrors existing code in inc::Module::Install::Metadata.
    
    The requires_rt line was moved earlier because it also sets a minimum
    version of perl, which is necessary for ->include_deps to determine what
    needs to be bundled along with YAML::Tiny in the distribution.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 04f1558..dae51fa 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -54,6 +54,9 @@ sub RTx {
     my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
     unshift @INC, $lib_path;
 
+    # Set a baseline minimum version
+    $self->requires_rt('4.0.0');
+
     # Installation locations
     my %path;
     $path{$_} = $RT::LocalPluginPath . "/$name/$_"
@@ -85,8 +88,11 @@ lexicons ::
 .
     }
 
+    $self->load('RTxPlugin');
+    $self->include_deps( 'YAML::Tiny', 0 ) if $self->admin;
     my $postamble = << ".";
 install ::
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxPlugin()"
 \t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\"
 .
 
@@ -144,7 +150,6 @@ install ::
         }
     }
 
-    $self->requires_rt('4.0.0');
 }
 
 sub requires_rt {
diff --git a/lib/Module/Install/RTx/Runtime.pm b/lib/Module/Install/RTx/Runtime.pm
index d308016..8f22c4f 100644
--- a/lib/Module/Install/RTx/Runtime.pm
+++ b/lib/Module/Install/RTx/Runtime.pm
@@ -52,4 +52,25 @@ sub RTxDatabase {
     (system($^X, @args) == 0) or die "...returned with error: $?\n";
 }
 
+sub RTxPlugin {
+    my ($self, $name) = @_;
+
+    $self->_rt_runtime_load;
+    require YAML::Tiny;
+    my $data = YAML::Tiny::LoadFile('META.yml');
+    my $name = $data->{name};
+
+    my @enabled = RT->Config->Get('Plugins');
+    for my $required (@{$data->{x_requires_rt_plugins} || []}) {
+        next if grep {$required eq $_} @enabled;
+
+        warn <<"EOT";
+
+**** Warning: $name requires that the $required plugin be installed and
+              enabled; it is not currently in \@Plugins.
+
+EOT
+    }
+}
+
 1;

commit d7a3b424e1671d93fcc494b3ddc67d2312b54b01
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 19 16:08:11 2014 -0400

    Note the version of Module::Install::RTx, for ease of searching

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index dae51fa..cd5e12e 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -29,6 +29,7 @@ sub RTx {
         unless $self->version;
     $self->abstract("$name Extension")
         unless $self->abstract;
+    $self->add_metadata("x_module_install_rtx_version", $VERSION );
 
     # Try to find RT.pm
     my @prefixes = qw( /opt /usr/local /home /usr /sw );

commit 1ba32290e42d208c441ae360d55ed3fa6b56bdde
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 13:58:15 2014 -0400

    Tidy Changes file, bump to development release 0.34_01

diff --git a/Changes b/Changes
index e8db6b6..64fd630 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,17 @@
+0.34_01 2014-06-17
+ - Remove RT 3.8-specific code
+ - Update documentation to reflect 3.8-era Plugin world order
+ - Add requires_rt_plugin helper
+ - Remove WITH_SUBDIRS support
+ - Remove non-working PREFIX support
+ - Add RT version information to META.yml
+ - Default minimum perl version based on minimum RT version
+ - Tidy Changes file
+
 0.34 2014-05-20
- - Backcompat workaround so you can ship static/css and static/js and
-   on 4.0 we copy to html/NoAuth/{css,js}.  Isn't a full win for images
-   which needed a dhandler hack under 4.0.
+ - Backcompat workaround so you can ship static/css and static/js and on
+   4.0 we copy to html/NoAuth/{css,js}.  Isn't a full win for images which
+   needed a dhandler hack under 4.0.
 
 0.33 2014-03-17
  - Better error message when requires_rt dies
@@ -14,156 +24,124 @@
 0.32_01 2014-01-10
  - Now that we aren't packaging extensions against 3.6, we can use
    cmp_versions imported from RT core rather than copy/paste.
- - new rt_too_new which allows you to bail out before being installed
-   on a version of RT which is too new for you to function normally on
+ - new rt_too_new which allows you to bail out before being installed on a
+   version of RT which is too new for you to function normally on
    (corollary to requires_rt).
  - requires_rt now dies if your RT is too old rather than just warning.
 
 0.32 2013-09-06
-* new make upgrade-database command
-** this feature needs RT 4.2 or 4.0.14+ for maximum benefit
-** used in the RTIR 3.0 release series
+ - new make upgrade-database command; this feature needs RT 4.2 or
+   4.0.14+ for maximum benefit, and is used in the RTIR 3.0 release
+   series
 
 0.31 2013-04-08
-* Changes targetting newer releases of RT
-** Use the DatabaseAdmin configuration is supplied
-** Install /static/ on future 4.2 versions of RT
+ - Use the DatabaseAdmin configuration if supplied
+ - Install /static/ on future 4.2 versions of RT
 
 0.30 2012-11-06
-* remove a lot of old unused code
-* add support for a 4.1 feature that records database changes made by the extension
+ - remove a lot of old unused code
+ - add support for a 4.1 feature that records database changes made by the
+   extension
 
 0.29_02 2012-08-16
-* further removal of make factory, this time 'make dropdb'
+ - further removal of make factory, this time 'make dropdb'
 
 0.29_01 2012-08-16
-* Remove support for 'make factory'
-* Add support for a new 4.1 feature that records database changes made by the extension
+ - Remove support for 'make factory'
+ - Add support for a new 4.1 feature that records database changes made by
+   the extension
 
 0.29 2011-05-20
-* add requires_rt to handle requiring an RT version
-  since MakeMaker and Module::Install::AutoInstall can't deal
-  with RT version numbers.
+ - add requires_rt to handle requiring an RT version since MakeMaker and
+   Module::Install::AutoInstall can't deal with RT version numbers.
 
 0.28 2011-03-15
-* search /opt/rt4 for RT.pm
+ - search /opt/rt4 for RT.pm
 
 0.27 2010-12-16
-* Include RT's lib/ directory in INC so that requires() 
-  on RT::VERSION work properly
+ - Include RT's lib/ directory in INC so that requires() on RT::VERSION
+   work properly
 
 0.26 2010-12-14
-
-* Search RTHOME before searching @INC
-  This works around distribution packages lurking in @INC
+ - Search RTHOME before searching @INC This works around distribution
+   packages lurking in @INC
 
 0.25 2009-10-08
-
-* Make prompt for lib path clearer [rt.cpan.org #50328
-* trim RT.pm from lib paths entered by users
+ - Make prompt for lib path clearer [rt.cpan.org #50328
+ - trim RT.pm from lib paths entered by users
 
 0.24 2008-09-15
-
-* updated docs
-* die when target is RT 3.8.0
-* install libs only into one path, don't double-install them
-  on RT 3.8.x
-* delete VERSION from POD, we just always forget to update it
+ - updated docs
+ - die when target is RT 3.8.0
+ - install libs only into one path, don't double-install them on RT 3.8.x
+ - delete VERSION from POD, we just always forget to update it
 
 0.23 2008-05-09
-
-* RT now respects the --datafile flag to rt-setup-database when
-  used with --action acl or --action schema.
-  Don't pass the initialdata file when we're doing schema changes
+ - RT now respects the --datafile flag to rt-setup-database when used with
+   --action acl or --action schema. Don't pass the initialdata file when
+   we're doing schema changes
 
 0.22 2008-03-25
-
-* Add local lib path to the @INC when we call any script that may
-  load RT config.
+ - Add local lib path to the @INC when we call any script that may load RT
+   config.
 
 0.21 2007-12-07
-
-* LICENSING CHANGE: This compilation and all individual files in it
-  are now under the permissive "MIT" license.  See the COPYRIGHT
-  section in README for the new terms.
-
-* Cleanup on POD, changelog, README, etc.
-
-* Bump dependency of Module::Install::Admin to 0.40, so we can make use of
-  all_from() and drop the parentheses in Makefile.PL commands.
+ - LICENSING CHANGE: This compilation and all individual files in it are
+   now under the permissive "MIT" license.  See the COPYRIGHT section in
+   README for the new terms.
+ - Cleanup on POD, changelog, README, etc.
+ - Bump dependency of Module::Install::Admin to 0.40, so we can make use of
+   all_from() and drop the parentheses in Makefile.PL commands.
 
 0.20 2007-12-05
+ - Support for new RT 3.7 "RT Plugin" mechanism.
+ - No longer tries to write to the global local perl man and site
+   directories (packlists and manpages), instead installing them within the
+   RT hierarchy.
+
+0.11 2005-02-26
+ - make initdb now prompts for dba password.
+
+0.10 2004-09-09
+ - "make initialize-database" added as an alias to "make initdb", for
+   better consistency with core RT installation. Reported by: Sika.
+
+0.09 2004-09-09
+ - Moved under SVK management; remove all keyword expansion lines.
+ - Corrected the use of $ENV{RTHOME} and documented it.
+
+0.08 2004-05-31
+ - "make initdb" now moved to M::I::RTx::Factory, so the person running
+   "perl Makefile.PL" needs not have permission to read RT_SiteConfig.pm.
+ - M::I::RTx::Factory now survives pod-stripping.
+ - Jesse reports that RTx('RT-Foo-Bar') breaks.
+ - Improve table detection in Pg.
+ - Better handling failed require() on _Overlay classes in the factory.
+
+0.07 2004-05-13
+ - Need to use RT::LoadConfig instead of requiring the config files
+   directly. Reported by: Jesse Vincent
+
+0.06 2004-05-10
+ - Support "make factory", "make initdb", "make dropdb" for extensions that
+   has its own initialdata and schema.
+
+0.05 2004-02-01
+ - Now installs libs to $RT::LocalPath/lib instead of perl's sitelib.
+ - Now properly skips lib installation when WITH_SUBDIRS does not include
+   lib.
+ - Allow overriding prefix with $ENV{PREFIX}
+
+0.04 2004-01-10
+ - Update copyright years.
+ - Make var/ directory writable
+ - Some people insist on doing "make initialize-database" before "make
+   install".
+ - Add etc/initialdata insertion.
+ - Take care of "inplace" layout by also probing in lib/RT.pm.
+ - Now takes WITH_SUBDIRS to restrict the subdirectories to install.
+ - Some POD cleanups.
+
+0.01 2003-12-15
+ - Initial release.
 
-* Support for new RT 3.7 "RT Plugin" mechanism.
-
-* No longer tries to write to the global local perl man and site directories
-  (packlists and manpages), instead installing them within the RT hierarchy.
-
-0.11 - 2005-02-26
-
-* make initdb now prompts for dba password.
-
-0.10 - 2004-09-09
-
-* "make initialize-database" added as an alias to "make initdb",
-  for better consistency with core RT installation.
-
-  Reported by: Sika.
-
-0.09 - 2004-09-09
-
-* Moved under SVK management; remove all keyword expansion lines.
-
-* Corrected the use of $ENV{RTHOME} and documented it.
-
-0.08 - 2004-05-31
-
-* "make initdb" now moved to M::I::RTx::Factory, so the person
-  running "perl Makefile.PL" needs not have permission to read
-  RT_SiteConfig.pm.
-
-* M::I::RTx::Factory now survives pod-stripping.
-
-* Jesse reports that RTx('RT-Foo-Bar') breaks.
-
-* Improve table detection in Pg.
-
-* Better handling failed require() on _Overlay classes in the factory.
-
-0.07 - 2004-05-13
-
-* Need to use RT::LoadConfig instead of requiring the config files directly.
-  Reported by: Jesse Vincent
-
-0.06 - 2004-05-10
-
-* Support "make factory", "make initdb", "make dropdb"
-  for extensions that has its own initialdata and schema.
-
-0.05 - 2004-02-01
-
-* Now installs libs to $RT::LocalPath/lib instead of perl's sitelib.
-
-* Now properly skips lib installation when WITH_SUBDIRS does not include lib.
-
-* Allow overriding prefix with $ENV{PREFIX}
-
-0.04 - 2004-01-10
-
-* Update copyright years.
-
-* Make var/ directory writable
-
-* Some people insist on doing "make initialize-database" before "make install".
-
-* Add etc/initialdata insertion.
-
-* Take care of "inplace" layout by also probing in lib/RT.pm.
-
-* Now takes WITH_SUBDIRS to restrict the subdirectories to install.
-
-* Some POD cleanups.
-
-0.01 - 2003-12-15
-
-* Initial release.
diff --git a/META.yml b/META.yml
index 06827f3..0ebadd8 100644
--- a/META.yml
+++ b/META.yml
@@ -21,7 +21,7 @@ no_index:
 provides:
   Module::Install::RTx:
     file: lib/Module/Install/RTx.pm
-    version: 0.34
+    version: 0.34_01
   Module::Install::RTx::Runtime:
     file: lib/Module/Install/RTx/Runtime.pm
 requires:
@@ -29,4 +29,4 @@ requires:
   perl: 5.8.0
 resources:
   license: http://opensource.org/licenses/mit-license.php
-version: 0.34
+version: 0.34_01
diff --git a/README b/README
index 65a19a2..6780960 100644
--- a/README
+++ b/README
@@ -2,82 +2,55 @@ NAME
     Module::Install::RTx - RT extension installer
 
 SYNOPSIS
-    In the Makefile.PL of the "RT-Extension-Foo" module:
+    In the Makefile.PL of the "RT-Extension-Example" module:
 
         use inc::Module::Install;
-        RTx 'RT-Extension-Foo';
-        WriteAll();
-
-    optionally add a
+        RTx 'RT-Extension-Example';
 
-        requires_rt('3.8.9');
+        requires_rt '4.2.0';
+        rt_too_new  '4.4.0';
 
-    to die if your RT version is too old during install
+        WriteAll();
 
 DESCRIPTION
-    This Module::Install extension implements a function, "RTx", that takes
-    the extension name as the only argument.
-
-    It arranges for certain subdirectories to install into the installed RT
-    location, but does not affect the usual "lib" and "t" directories.
-
-    The directory mapping table is as below:
-
-        ./bin   => $RT::LocalPath/bin
-        ./etc   => $RT::LocalPath/etc/$NAME
-        ./html  => $RT::MasonComponentRoot
-        ./po    => $RT::LocalLexiconPath/$NAME
-        ./sbin  => $RT::LocalPath/sbin
-        ./var   => $RT::VarPath/$NAME
-
-    Under the default RT3 layout in /opt and with the extension name "Foo",
-    it becomes:
-
-        ./bin   => /opt/rt3/local/bin
-        ./etc   => /opt/rt3/local/etc/Foo
-        ./html  => /opt/rt3/share/html
-        ./po    => /opt/rt3/local/po/Foo
-        ./sbin  => /opt/rt3/local/sbin
-        ./var   => /opt/rt3/var/Foo
-
-    By default, all these subdirectories will be installed with "make
-    install". you can override this by setting the "WITH_SUBDIRS"
-    environment variable to a comma-delimited subdirectory list, such as
-    "html,sbin".
-
-    Alternatively, you can also specify the list as a command-line option to
-    "Makefile.PL", like this:
-
-        perl Makefile.PL WITH_SUBDIRS=sbin
-
-    This module also provides the following helper functions
-
-  requires_rt
+    This Module::Install extension implements several functions for
+    installing RT extensions:
+
+  RTx '*extension name*'
+    This function arranges for the following directories to be installed, if
+    they exist (assuming "RTx('RT-Extension-Example')"):
+
+        ./bin    => $RT::LocalPluginPath/RT-Extension-Example/bin
+        ./etc    => $RT::LocalPluginPath/RT-Extension-Example/etc
+        ./html   => $RT::LocalPluginPath/RT-Extension-Example/html
+        ./lib    => $RT::LocalPluginPath/RT-Extension-Example/lib
+        ./po     => $RT::LocalPluginPath/RT-Extension-Example/po
+        ./sbin   => $RT::LocalPluginPath/RT-Extension-Example/sbin
+        ./static => $RT::LocalPluginPath/RT-Extension-Example/static
+        ./var    => $RT::LocalPluginPath/RT-Extension-Example/var
+
+  requires_rt *version*
     Takes one argument, a valid RT version. If an attempt is made to install
-    on an older RT, it will die before Makefile creation.
+    on an RT than that version, it will die before Makefile creation.
+
+  requires_rt_plugin *RT::Extension::Example* [, *version*]
+    Ensures that the given RT extension (and optional version) is installed
+    in the target RT instance; "requires" cannot be used because RT
+    extensions are not in @INC.
 
-  rt_too_new
-    Takes an RT version and prevents this module from being installed on any
-    version of RT equal to or newer than that. Useful if a particular
-    release of an extension only works on 4.0.x but not 4.2.x.
+  rt_too_new *version* [, *message*]
+    Takes one argument, a valid RT version, and prevents this module from
+    being installed on any version of RT equal to or newer than that. Useful
+    if a particular release of an extension only works on 4.0.x but not
+    4.2.x.
 
     Takes an optional second argument which allows you to specify a custom
     error message. This message is passed to sprintf with two string
     arguments, the current RT version and the version you specify.
 
 CAVEATS
-    *   Use full name when call RTx method in Makefile.PL, some magic has
-        been implemented in this installer to support RTx('Foo') for
-        'RTx-Foo' extension, but life proved that it's bad idea. Code still
-        there for backwards compatibility. It will be deleted eventually.
-
-    *   installer won't work with RT 3.8.0, as it has some bugs new plugins
-        sub-system.
-
-    *   layout of files has been changed between RT 3.6 and RT 3.8, old
-        files may influence behaviour of your extension. Recommend people
-        use clean dir on upgrade or guide how to remove old versions of your
-        extension.
+    *   Us the full name when calling RTx method in Makefile.PL; while
+        "RTx('Foo')" was once supported, it is no longer.
 
 ENVIRONMENT
     RTHOME
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index cd5e12e..9fc7ece 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -7,7 +7,7 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.34';
+our $VERSION = '0.34_01';
 
 use FindBin;
 use File::Glob     ();

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


More information about the Bps-public-commit mailing list