[Bps-public-commit] rt-extension-formtools branch, disabling-fields, updated. 0.08_01-1-ge35bbc4

Kevin Falcone falcone at bestpractical.com
Thu Apr 14 12:38:02 EDT 2011


The branch, disabling-fields has been updated
       via  e35bbc4f7c972d41e50cee74d3c3e01afdaecec5 (commit)
      from  4d85a92fe843a20165833fa73aa19b3bfa7646b4 (commit)

Summary of changes:
 inc/Module/Install/RTx.pm |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit e35bbc4f7c972d41e50cee74d3c3e01afdaecec5
Author: Kevin Falcone <kevin at jibsheet.com>
Date:   Thu Apr 14 12:37:57 2011 -0400

    proper MIRTx

diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index b93471b..b83e279 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -44,7 +44,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", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
                 } grep $_, @prefixes
         );
         until ( eval { require RT; $RT::LocalPath } ) {
@@ -186,13 +186,46 @@ sub RTxInit {
     die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
 }
 
+# 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 $version = shift;
-    warn "wants $version has $RT::VERSION";
+    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;
+
+    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";
+    }
 }
 
 1;
 
 __END__
 
-#line 309
+#line 348

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



More information about the Bps-public-commit mailing list