[Bps-public-commit] rt-extension-selfservicesimplesearch branch, master, updated. de57f30d60ba256a6023ebca1dab8e1db622f252

Alex Vandiver alexmv at bestpractical.com
Fri Jun 13 16:28:18 EDT 2014


The branch, master has been updated
       via  de57f30d60ba256a6023ebca1dab8e1db622f252 (commit)
       via  643f71b0000f2a47baea7fd80fec77830a5ca260 (commit)
      from  06213e27833cecba6809894c0e4886e067741df0 (commit)

Summary of changes:
 MANIFEST                                    | 17 +++++++
 META.yml                                    |  4 +-
 Makefile.PL                                 |  1 +
 README                                      |  2 +-
 html/SelfService/SimpleSearch.html          | 10 ++++-
 inc/Module/Install.pm                       |  2 +-
 inc/Module/Install/Base.pm                  |  2 +-
 inc/Module/Install/Can.pm                   |  2 +-
 inc/Module/Install/Fetch.pm                 |  2 +-
 inc/Module/Install/Makefile.pm              |  2 +-
 inc/Module/Install/Metadata.pm              |  2 +-
 inc/Module/Install/RTx.pm                   | 69 +++++++++++++++++------------
 inc/Module/Install/ReadmeFromPod.pm         |  2 +-
 inc/Module/Install/Win32.pm                 |  2 +-
 inc/Module/Install/WriteAll.pm              |  2 +-
 lib/RT/Extension/SelfServiceSimpleSearch.pm |  4 +-
 16 files changed, 80 insertions(+), 45 deletions(-)
 create mode 100644 MANIFEST

- Log -----------------------------------------------------------------
commit 643f71b0000f2a47baea7fd80fec77830a5ca260
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 13 16:22:26 2014 -0400

    Support both RT 4.0 and 4.2

diff --git a/html/SelfService/SimpleSearch.html b/html/SelfService/SimpleSearch.html
index 9582333..ba511e1 100644
--- a/html/SelfService/SimpleSearch.html
+++ b/html/SelfService/SimpleSearch.html
@@ -106,7 +106,13 @@
 
 <%INIT>
 my $title = loc("Search for tickets");
-use RT::Search::Googleish;
+my $class;
+if ( eval { require RT::Search::Simple; 1 } ) {
+    $class = "RT::Search::Simple";
+} else {
+    require RT::Search::Googleish;
+    $class = "RT::Search::Googleish";
+}
 
 if ($q && !$Query) {
     my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
@@ -123,7 +129,7 @@ if ($q && !$Query) {
 
     $m->callback( %ARGS, CallbackName => 'SearchArgs', args => \%args);
 
-    my $search = RT::Search::Googleish->new(%args);
+    my $search = $class->new(%args);
 
     my $id = $session{'CurrentUser'}->id;
     $Query = join ' AND ', $search->QueryToSQL(), "( Watcher.id = $id )";

commit de57f30d60ba256a6023ebca1dab8e1db622f252
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 13 16:23:57 2014 -0400

    Version 0.02 releng

diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..897716d
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,17 @@
+html/Callbacks/SelfServiceSimpleSearch/Elements/Tabs/SelfService
+html/SelfService/SimpleSearch.html
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/ReadmeFromPod.pm
+inc/Module/Install/RTx.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/RT/Extension/SelfServiceSimpleSearch.pm
+Makefile.PL
+MANIFEST			This list of files
+META.yml
+README
diff --git a/META.yml b/META.yml
index 74c6c37..db7a716 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ configure_requires:
   ExtUtils::MakeMaker: 6.36
 distribution_type: module
 dynamic_config: 1
-generated_by: 'Module::Install version 1.06'
+generated_by: 'Module::Install version 1.08'
 license: gplv2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,4 +20,4 @@ no_index:
     - inc
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.01
+version: '0.02'
diff --git a/Makefile.PL b/Makefile.PL
index 3f97647..accb007 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,4 +6,5 @@ all_from 'lib/RT/Extension/SelfServiceSimpleSearch.pm';
 readme_from 'lib/RT/Extension/SelfServiceSimpleSearch.pm';
 license  'gplv2';
 
+sign;
 WriteAll;
diff --git a/README b/README
index 1260689..2926ce5 100644
--- a/README
+++ b/README
@@ -35,7 +35,7 @@ BUGS
     ceSimpleSearch>.
 
 LICENSE AND COPYRIGHT
-    This software is Copyright 2013 Best Practical Solutions, LLC.
+    This software is Copyright 2013-2014 Best Practical Solutions, LLC.
 
     This is free software, licensed under:
 
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 4ecf46b..7680c84 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 802844a..3e63345 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 22167b8..93f248d 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index bee0c4f..ecc0d53 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 7052f36..c0978a4 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 58430f3..e4112f8 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..f9ead18 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.34';
 
 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/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index 6a80818..b5e03c3 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,7 +7,7 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.20';
+$VERSION = '0.22';
 
 sub readme_from {
   my $self = shift;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index eeaa3fe..e529382 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 85d8018..2c74308 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.06';
+	$VERSION = '1.08';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }
diff --git a/lib/RT/Extension/SelfServiceSimpleSearch.pm b/lib/RT/Extension/SelfServiceSimpleSearch.pm
index 674c0a9..821d09f 100644
--- a/lib/RT/Extension/SelfServiceSimpleSearch.pm
+++ b/lib/RT/Extension/SelfServiceSimpleSearch.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 package RT::Extension::SelfServiceSimpleSearch;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 =head1 NAME
 
@@ -54,7 +54,7 @@ L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-Self
 
 =head1 LICENSE AND COPYRIGHT
 
-This software is Copyright 2013 Best Practical Solutions, LLC.
+This software is Copyright 2013-2014 Best Practical Solutions, LLC.
 
 This is free software, licensed under:
 

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


More information about the Bps-public-commit mailing list