[Bps-public-commit] Module-Install-RTx branch, master, updated. 0.32-8-g4133180

Kevin Falcone falcone at bestpractical.com
Fri Jan 10 16:57:50 EST 2014


The branch, master has been updated
       via  4133180fa67d8569bb39b43a148fa2d67e780401 (commit)
       via  3fd511b23b8b969ed820d9f011b3f369b0c61f2c (commit)
       via  9454a8d70590a778cf18aee4d976efa2b18f31dc (commit)
       via  3ed995f9dbb1122e5db2b42dd1ee13fa2f0fa6ce (commit)
      from  66dca369a7c846abd13e4dd499f85fca2d809c69 (commit)

Summary of changes:
 Changes                   |  8 +++++++
 MANIFEST                  |  1 +
 META.yml                  |  6 +++---
 Makefile.PL               |  2 ++
 README                    | 53 +++++++++++++++++++++++++++++++++++------------
 lib/Module/Install/RTx.pm | 51 ++++++++++++++++++++++++++++++++++++++-------
 6 files changed, 97 insertions(+), 24 deletions(-)

- Log -----------------------------------------------------------------
commit 3ed995f9dbb1122e5db2b42dd1ee13fa2f0fa6ce
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jan 8 15:54:38 2014 -0500

    Documentation updates
    
    Fix a few glaring typos/omissions.  Add docs for requires_rt and
    rt_too_new.

diff --git a/README b/README
index 5abd4a5..1fdfc1e 100644
--- a/README
+++ b/README
@@ -8,9 +8,15 @@ SYNOPSIS
         RTx 'RT-Extension-Foo';
         WriteAll();
 
+    optionally add a
+
+        requires_rt('3.8.9');
+
+    to warn if your RT version is too old during install
+
 DESCRIPTION
-    This Module::Install extension implements one function, "RTx", that
-    takes the extension name as the only argument.
+    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.
@@ -44,16 +50,34 @@ DESCRIPTION
 
         perl Makefile.PL WITH_SUBDIRS=sbin
 
+    This module also provides the following helper functions
+
+  requires_rt
+    Takes one argument, a valid RT version. If an attempt is made to install
+    on an older RT, it will warn about this during the Makefile creation.
+
+  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.
+
+    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 want 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.
+    *   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.
 
 ENVIRONMENT
     RTHOME
@@ -65,10 +89,13 @@ SEE ALSO
     <http://www.bestpractical.com/rt/>
 
 AUTHORS
-    Audrey Tang <cpan at audreyt.org>
+    Best Practical Solutions
+
+    (Originally) Audrey Tang <cpan at audreyt.org>
 
 COPYRIGHT
-    Copyright 2003, 2004, 2007 by Audrey Tang <cpan at audreyt.org>.
+    Copyright 2003, 2004, 2007 by Audrey Tang <cpan at audreyt.org>. Copyright
+    2008-2014 Best Practical Solutions
 
     This software is released under the MIT license cited below.
 
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 53a8962..9235cec 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -224,7 +224,7 @@ to warn if your RT version is too old during install
 
 =head1 DESCRIPTION
 
-This B<Module::Install> extension implements one function, C<RTx>,
+This B<Module::Install> extension implements a function, C<RTx>,
 that takes the extension name as the only argument.
 
 It arranges for certain subdirectories to install into the installed
@@ -258,6 +258,23 @@ C<Makefile.PL>, like this:
 
     perl Makefile.PL WITH_SUBDIRS=sbin
 
+This module also provides the following helper functions
+
+=head2 requires_rt
+
+Takes one argument, a valid RT version. If an attempt is made to install
+on an older RT, it will warn about this during the Makefile creation.
+
+=head2 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.
+
+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.
+
 =head1 CAVEATS
 
 =over 4
@@ -267,7 +284,7 @@ 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 want work with RT 3.8.0, as it has some bugs new plugins
+=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
@@ -294,11 +311,14 @@ L<http://www.bestpractical.com/rt/>
 
 =head1 AUTHORS
 
-Audrey Tang <cpan at audreyt.org>
+Best Practical Solutions
+
+(Originally) Audrey Tang <cpan at audreyt.org>
 
 =head1 COPYRIGHT
 
 Copyright 2003, 2004, 2007 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+Copyright 2008-2014 Best Practical Solutions
 
 This software is released under the MIT license cited below.
 

commit 9454a8d70590a778cf18aee4d976efa2b18f31dc
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Jan 9 16:11:04 2014 -0500

    Switch from warning to dying
    
    We should refuse to install harder when your RT is too hold.

diff --git a/README b/README
index 1fdfc1e..65a19a2 100644
--- a/README
+++ b/README
@@ -12,7 +12,7 @@ SYNOPSIS
 
         requires_rt('3.8.9');
 
-    to warn if your RT version is too old during install
+    to die if your RT version is too old during install
 
 DESCRIPTION
     This Module::Install extension implements a function, "RTx", that takes
@@ -54,7 +54,7 @@ DESCRIPTION
 
   requires_rt
     Takes one argument, a valid RT version. If an attempt is made to install
-    on an older RT, it will warn about this during the Makefile creation.
+    on an older RT, it will die before Makefile creation.
 
   rt_too_new
     Takes an RT version and prevents this module from being installed on any
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 9235cec..d0d3a8a 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -184,7 +184,7 @@ sub requires_rt {
 
     if ($sorted[-1] eq $version) {
         # should we die?
-        warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+        die "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
     }
 }
 
@@ -220,7 +220,7 @@ optionally add a
 
     requires_rt('3.8.9');
 
-to warn if your RT version is too old during install
+to die if your RT version is too old during install
 
 =head1 DESCRIPTION
 
@@ -263,7 +263,7 @@ This module also provides the following helper functions
 =head2 requires_rt
 
 Takes one argument, a valid RT version. If an attempt is made to install
-on an older RT, it will warn about this during the Makefile creation.
+on an older RT, it will die before Makefile creation.
 
 =head2 rt_too_new
 

commit 3fd511b23b8b969ed820d9f011b3f369b0c61f2c
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Jan 10 15:57:46 2014 -0500

    Work around loading RT::Handle loading the config.
    
    Calling require RT::Handle; executes FinalizeDatabaseType which calls
    RT->Config->Get('DatabaseType').  On 3.8 this errors because the config
    isn't loaded.  On 4.0 and 4.2 this transparently loads the config.
    
    Loading your config requires a user who can read RT_SiteConfig.pm which
    means that you would be required to run perl Makefile.PL as root.
    
    Instead, dummy up Config just enough to get RT::Handle loaded so we can call
    cmp_versions.  If anything later calls RT::LoadConfig; our shenanigans
    will be wiped clean.

diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index d0d3a8a..68adb19 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -179,7 +179,7 @@ sub requires_rt {
     # if we're exactly the same version as what we want, silently return
     return if ($version eq $RT::VERSION);
 
-    require RT::Handle;
+    _load_rt_handle();
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
@@ -192,7 +192,7 @@ 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";
 
-    require RT::Handle;
+    _load_rt_handle();
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[0] eq $version) {
@@ -200,6 +200,21 @@ sub rt_too_new {
     }
 }
 
+# RT::Handle runs FinalizeDatabaseType which calls RT->Config->Get
+# On 3.8, this dies.  On 4.0/4.2 ->Config transparently runs LoadConfig.
+# LoadConfig requires being able to read RT_SiteConfig.pm (root) so we'd
+# like to avoid pushing that on users.
+# Fake up just enough Config to let FinalizeDatabaseType finish, and
+# anyone later calling LoadConfig will overwrite our shenanigans.
+sub _load_rt_handle {
+    unless ($RT::Config) {
+        require RT::Config;
+        $RT::Config = RT::Config->new;
+        RT->Config->Set('DatabaseType','mysql');
+    }
+    require RT::Handle;
+}
+
 1;
 
 __END__

commit 4133180fa67d8569bb39b43a148fa2d67e780401
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jan 8 15:55:21 2014 -0500

    Prep for 0.32_1 dev release

diff --git a/Changes b/Changes
index 6c603e8..1d15c78 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,11 @@
+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
+   (corollary to requires_rt).
+ - requires_rt now dies if your RT is too old rather than just warning.
+
 [Changes for 0.32 2013-09-06]
 * new make upgrade-database command
 ** this feature needs RT 4.2 or 4.0.14+ for maximum benefit
diff --git a/MANIFEST b/MANIFEST
index abc175e..b88bf6c 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,6 +3,7 @@ inc/Module/Install.pm
 inc/Module/Install/Base.pm
 inc/Module/Install/Makefile.pm
 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
diff --git a/META.yml b/META.yml
index 58aeec5..21654cb 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 ---
 abstract: 'RT extension installer'
 author:
-  - 'Audrey Tang <cpan at audreyt.org>'
+  - 'Best Practical Solutions'
 build_requires:
   ExtUtils::MakeMaker: 6.59
 configure_requires:
@@ -21,7 +21,7 @@ no_index:
 provides:
   Module::Install::RTx:
     file: lib/Module/Install/RTx.pm
-    version: 0.32
+    version: 0.32_01
   Module::Install::RTx::Factory:
     file: lib/Module/Install/RTx/Factory.pm
 requires:
@@ -29,4 +29,4 @@ requires:
   perl: 5.8.0
 resources:
   license: http://opensource.org/licenses/mit-license.php
-version: 0.32
+version: 0.32_01
diff --git a/Makefile.PL b/Makefile.PL
index 3c14dab..c41b75a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,8 +1,10 @@
 use inc::Module::Install;
 
 name	        'Module-Install-RTx';
+author          'Best Practical Solutions';
 all_from        'lib/Module/Install/RTx.pm';
 requires        'Module::Install::Admin' => 0.40;
+readme_from     'lib/Module/Install/RTx.pm';
 
 auto_provides;
 &WriteAll( check_nmake => 0, sign => 1 );
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 68adb19..4796328 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.32';
+our $VERSION = '0.32_01';
 
 use FindBin;
 use File::Glob     ();

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



More information about the Bps-public-commit mailing list