[Bps-public-commit] RT-Extension-MergeUsers branch, master, updated. 0.12_03-1-g598d3de

Alex Vandiver alexmv at bestpractical.com
Thu Mar 27 12:57:08 EDT 2014


The branch, master has been updated
       via  598d3deffe67047bd2f7f7d06e4eac7711094fc7 (commit)
      from  556a6cf4bd9239cdeb99d32135eeb83bc4058b96 (commit)

Summary of changes:
 Changes                        |  2 +-
 META.yml                       |  2 +-
 Makefile.PL                    |  3 +-
 inc/Module/Install/RTx.pm      | 69 ++++++++++++++++++++++++------------------
 lib/RT/Extension/MergeUsers.pm |  2 +-
 5 files changed, 45 insertions(+), 33 deletions(-)

- Log -----------------------------------------------------------------
commit 598d3deffe67047bd2f7f7d06e4eac7711094fc7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 27 12:52:37 2014 -0400

    Version 0.12 releng

diff --git a/Changes b/Changes
index b0b9da5..9d7d30b 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.12
+0.12 Thu Mar 27 12:52:17 EST 2014
 
    * Merge users as the current user, not always the superuser
    * Propagate Disabled bit to users that are merged in
diff --git a/META.yml b/META.yml
index 4732eff..94c4949 100644
--- a/META.yml
+++ b/META.yml
@@ -23,4 +23,4 @@ requires:
   perl: 5.8.3
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.12_03
+version: 0.12
diff --git a/Makefile.PL b/Makefile.PL
index c9f52ce..e5b0e3d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -24,7 +24,8 @@ substitute( {
     { sufix => '.in' },
     'bin/rt-update-merged-users',
     'bin/rt-merge-users',
-);  
+);
 
+sign();
 auto_install();
 WriteAll();
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..8616d06 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     ();
@@ -88,6 +88,11 @@ sub RTx {
             ."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';
@@ -136,7 +141,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 +181,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 367
diff --git a/lib/RT/Extension/MergeUsers.pm b/lib/RT/Extension/MergeUsers.pm
index 57e5444..3172081 100644
--- a/lib/RT/Extension/MergeUsers.pm
+++ b/lib/RT/Extension/MergeUsers.pm
@@ -49,7 +49,7 @@ use warnings; no warnings qw(redefine);
 
 package RT::Extension::MergeUsers;
 
-our $VERSION = '0.12_03';
+our $VERSION = '0.12';
 
 =head1 NAME
 

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



More information about the Bps-public-commit mailing list