[Bps-public-commit] rt-extension-assets branch, master, updated. 1.01rc2-2-ga0e251e

Alex Vandiver alexmv at bestpractical.com
Fri May 16 14:16:56 EDT 2014


The branch, master has been updated
       via  a0e251e619282f5a261871a7542a17b650edf1be (commit)
      from  40dba7c6eaf1f796d2e52244fc2de5584d745875 (commit)

Summary of changes:
 MANIFEST                   |  1 +
 META.yml                   |  2 +-
 inc/Module/Install/RTx.pm  | 64 +++++++++++++++++++++++++---------------------
 lib/RT/Extension/Assets.pm |  2 +-
 4 files changed, 38 insertions(+), 31 deletions(-)

- Log -----------------------------------------------------------------
commit a0e251e619282f5a261871a7542a17b650edf1be
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri May 16 14:10:34 2014 -0400

    Version 1.01 releng

diff --git a/MANIFEST b/MANIFEST
index 964579a..1dde38b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -122,6 +122,7 @@ xt/collection.t
 xt/compile.t
 xt/lib/RT/Extension/Assets/Test.pm.in
 xt/links.t
+xt/pod.t
 xt/rights.t
 xt/roles.t
 xt/web.t
diff --git a/META.yml b/META.yml
index 101c47b..cdfc51f 100644
--- a/META.yml
+++ b/META.yml
@@ -32,4 +32,4 @@ requires:
   perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 1.0rc1
+version: 1.01
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..00cf565 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.32';
+our $VERSION = '0.33';
 
 use FindBin;
 use File::Glob     ();
@@ -136,7 +136,9 @@ install ::
         $has_etc{acl}++;
     }
     if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; }
-    if ( -d 'etc/upgrade/' )    { $has_etc{upgrade}++; }
+    if ( grep { /\d+\.\d+\.\d+.*$/ } glob('etc/upgrade/*.*.*') ) {
+        $has_etc{upgrade}++;
+    }
 
     $self->postamble("$postamble\n");
     unless ( $subdirs{'lib'} ) {
@@ -174,46 +176,50 @@ install ::
     }
 }
 
-# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
-{ my %word = (
-    a     => -4,
-    alpha => -4,
-    b     => -3,
-    beta  => -3,
-    pre   => -2,
-    rc    => -1,
-    head  => 9999,
-);
-sub cmp_version($$) {
-    my ($a, $b) = (@_);
-    my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
-        split /([^0-9]+)/, $a;
-    my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
-        split /([^0-9]+)/, $b;
-    @a > @b
-        ? push @b, (0) x (@a- at b)
-        : push @a, (0) x (@b- at a);
-    for ( my $i = 0; $i < @a; $i++ ) {
-        return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
-    }
-    return 0;
-}}
 sub requires_rt {
     my ($self,$version) = @_;
 
     # if we're exactly the same version as what we want, silently return
     return if ($version eq $RT::VERSION);
 
-    my @sorted = sort cmp_version $version,$RT::VERSION;
+    _load_rt_handle();
+    my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     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";
+    }
+}
+
+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";
+
+    _load_rt_handle();
+    my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
+
+    if ($sorted[0] eq $version) {
+        die sprintf($msg,$RT::VERSION,$version);
+    }
+}
+
+# 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__
 
-#line 336
+#line 362
diff --git a/lib/RT/Extension/Assets.pm b/lib/RT/Extension/Assets.pm
index 6f7217f..d19aac5 100644
--- a/lib/RT/Extension/Assets.pm
+++ b/lib/RT/Extension/Assets.pm
@@ -50,7 +50,7 @@ use strict;
 use warnings;
 package RT::Extension::Assets;
 
-our $VERSION = '1.01rc2';
+our $VERSION = '1.01';
 
 # Loaded so they're available and rights are injected.
 use RT::Catalog;

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


More information about the Bps-public-commit mailing list