[Bps-public-commit] rt-extension-historyonchange branch, master, updated. 0.01-4-g02f8445

Kevin Falcone falcone at bestpractical.com
Fri Mar 7 16:43:34 EST 2014


The branch, master has been updated
       via  02f8445f1c12b3e34f7ebeb413a8122d2283742d (commit)
       via  70debde2f55184dbaf7f20ac8d0acb16be1706d7 (commit)
       via  934eaedd5ed8045d0dde35d0461e9366eed20bf7 (commit)
       via  6257c838173c339d2ab0696b25e5180f1419623e (commit)
      from  c7f6ac9d71124bb3332b6001149424ab81f95312 (commit)

Summary of changes:
 Changes                             |  8 +++++
 MANIFEST                            |  1 +
 META.yml                            |  2 +-
 Makefile.PL                         |  1 +
 inc/Module/Install/RTx.pm           | 64 ++++++++++++++++++++-----------------
 lib/RT/Extension/HistoryOnChange.pm |  2 +-
 6 files changed, 47 insertions(+), 31 deletions(-)
 create mode 100644 Changes

- Log -----------------------------------------------------------------
commit 6257c838173c339d2ab0696b25e5180f1419623e
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Mar 7 16:40:11 2014 -0500

    We say 4.2 in the docs, but really mean it

diff --git a/Makefile.PL b/Makefile.PL
index 0897a15..ae23248 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,5 +5,6 @@ RTx 'RT-Extension-HistoryOnChange';
 all_from 'lib/RT/Extension/HistoryOnChange.pm';
 readme_from 'lib/RT/Extension/HistoryOnChange.pm';
 license  'gplv2';
+requires_rt('4.2.0');
 
 WriteAll;

commit 934eaedd5ed8045d0dde35d0461e9366eed20bf7
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Mar 7 16:41:42 2014 -0500

    add a changes file

diff --git a/Changes b/Changes
new file mode 100644
index 0000000..9324760
--- /dev/null
+++ b/Changes
@@ -0,0 +1,8 @@
+Revision history for RT::Extension::HistoryOnChange
+
+0.02 2014-03-07
+ - add requires_rt('4.2.0') to prevent installs on 4.0
+
+0.01 2014-01-02
+ - Release to CPAN
+
diff --git a/MANIFEST b/MANIFEST
index 53b18c6..d22dc4e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,3 +1,4 @@
+Changes
 etc/history_on_change.diff
 html/Callbacks/HistoryOnChange/Elements/ShowHistory/SkipTransaction
 html/Callbacks/HistoryOnChange/Ticket/Modify.html/AfterForm

commit 70debde2f55184dbaf7f20ac8d0acb16be1706d7
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Mar 7 16:42:54 2014 -0500

    never version of Module::Install::RTx

diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..469eb42 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.32_02';
 
 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

commit 02f8445f1c12b3e34f7ebeb413a8122d2283742d
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Mar 7 16:43:07 2014 -0500

    Bump version for 0.02

diff --git a/META.yml b/META.yml
index b805c62..3fd1a0f 100644
--- a/META.yml
+++ b/META.yml
@@ -21,4 +21,4 @@ no_index:
     - inc
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.01
+version: 0.02
diff --git a/lib/RT/Extension/HistoryOnChange.pm b/lib/RT/Extension/HistoryOnChange.pm
index e44d9f8..6be7e02 100644
--- a/lib/RT/Extension/HistoryOnChange.pm
+++ b/lib/RT/Extension/HistoryOnChange.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 package RT::Extension::HistoryOnChange;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 =head1 NAME
 

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



More information about the Bps-public-commit mailing list