[Bps-public-commit] rt-extension-quickdelete branch, master, updated. 0.04-4-g4c5b6f8

Kevin Falcone falcone at bestpractical.com
Tue Aug 9 12:37:57 EDT 2011


The branch, master has been updated
       via  4c5b6f8cd0b4dcc2048b1ab510a680445ff0c21b (commit)
       via  46bf8da1993df2cb4d5a7b6aefe9c897283c3759 (commit)
       via  7f248687195910ef3d8c86a6a98e4645d9928dee (commit)
      from  13909647e4681a868a27c412dad11a10ab14c948 (commit)

Summary of changes:
 .gitignore                                         |    1 +
 META.yml                                           |    2 +-
 Makefile.PL                                        |    1 +
 README                                             |   60 --------------------
 .../Elements/RT__Ticket/ColumnMap/ColumnMap        |    1 +
 .../Ticket/Elements/Tabs/Default                   |    1 +
 inc/Module/Install.pm                              |    4 +-
 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                     |    9 ++-
 inc/Module/Install/RTx.pm                          |   47 ++++++++++++++-
 inc/Module/Install/ReadmeFromPod.pm                |   48 ++++++++++++++++
 inc/Module/Install/Win32.pm                        |    2 +-
 inc/Module/Install/WriteAll.pm                     |    2 +-
 lib/RT/Extension/QuickDelete.pm                    |    8 +--
 17 files changed, 112 insertions(+), 82 deletions(-)
 delete mode 100644 README
 create mode 100644 inc/Module/Install/ReadmeFromPod.pm

- Log -----------------------------------------------------------------
commit 7f248687195910ef3d8c86a6a98e4645d9928dee
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Aug 9 12:24:05 2011 -0400

    upgade MI

diff --git a/META.yml b/META.yml
index af0baa2..776d6bb 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 1.00'
+generated_by: 'Module::Install version 1.01'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 8ee839d..74caf9c 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.00';
+	$VERSION = '1.01';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -467,4 +467,4 @@ sub _CLASS ($) {
 
 1;
 
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b55bda3..d3662c9 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.00';
+	$VERSION = '1.01';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 71ccc27..276409a 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -9,7 +9,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index ec1f106..093cb7a 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.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 5dfd0e9..4c71003 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.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index cfe45b3..3b01e09 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.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -515,6 +515,7 @@ sub __extract_license {
 		'GNU Free Documentation license'     => 'unrestricted', 1,
 		'GNU Affero General Public License'  => 'open_source',  1,
 		'(?:Free)?BSD license'               => 'bsd',          1,
+		'Artistic license 2\.0'              => 'artistic_2',   1,
 		'Artistic license'                   => 'artistic',     1,
 		'Apache (?:Software )?license'       => 'apache',       1,
 		'GPL'                                => 'gpl',          1,
@@ -550,9 +551,9 @@ sub license_from {
 
 sub _extract_bugtracker {
 	my @links   = $_[0] =~ m#L<(
-	 \Qhttp://rt.cpan.org/\E[^>]+|
-	 \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
-	 \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+	 https?\Q://rt.cpan.org/\E[^>]+|
+	 https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+	 https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
 	 )>#gx;
 	my %links;
 	@links{@links}=();
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index b780a6c..73b9cda 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.25';
+our $VERSION = '0.29';
 
 use FindBin;
 use File::Glob     ();
@@ -44,8 +44,8 @@ sub RTx {
         local @INC = (
             $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
             @INC,
-            map { ( "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) } grep $_,
-            @prefixes
+            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
+                } grep $_, @prefixes
         );
         until ( eval { require RT; $RT::LocalPath } ) {
             warn
@@ -60,6 +60,7 @@ sub RTx {
     my $local_lib_path = "$RT::LocalPath/lib";
     print "Using RT configuration from $INC{'RT.pm'}:\n";
     unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
+    unshift @INC, $lib_path;
 
     $RT::LocalVarPath  ||= $RT::VarPath;
     $RT::LocalPoPath   ||= $RT::LocalLexiconPath;
@@ -185,8 +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 ($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 303
+#line 348
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index edc18b4..3139a63 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.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index d0f6599..1f724a7 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.00';
+	$VERSION = '1.01';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

commit 46bf8da1993df2cb4d5a7b6aefe9c897283c3759
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Aug 9 12:30:02 2011 -0400

    start generating the readme from pod automatically

diff --git a/.gitignore b/.gitignore
index b705beb..6eec439 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ rtldapimport
 *.bak
 t/tmp/
 t/lib/RT/Extension/LDAPImport/Test.pm
+README
diff --git a/Makefile.PL b/Makefile.PL
index 630f273..3888b69 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,6 +4,7 @@ RTx('RT-Extension-QuickDelete');
 author ('Jesse Vincent <jesse at bestpractical.com>');
 version_from ('lib/RT/Extension/QuickDelete.pm');
 abstract_from('lib/RT/Extension/QuickDelete.pm');
+readme_from('lib/RT/Extension/QuickDelete.pm');
 license('perl');
 requires('Test::More');
 
diff --git a/README b/README
deleted file mode 100644
index a517be8..0000000
--- a/README
+++ /dev/null
@@ -1,60 +0,0 @@
-NAME
-    RT::Extension::QuickDelete - Adds q "quick delete" button" to RT's
-    standard ticket search interface
-
-SYNOPSIS
-     perl Makefile.PL
-     make install
-
-     # If you're using RT 3.6.0 or RT 3.6.1, copy etc/3.6.1/ShowSearch to /opt/rt3/share/html/Elements/ShowSearch
-     # (This changed file is already included in RT 3.6.2)
- 
-     # Update your default RT search results format to include favorites link by adding this to your RT_SiteConfig.pm:
-
-     Set ($DefaultSearchResultFormat, qq{
-       '<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
-       '<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
-       Status,
-       QueueName,
-       OwnerName,
-       Priority,
-       QuickDelete,
-       '__NEWLINE__',
-       '',
-       '<small>__Requestors__</small>',
-       '<small>__CreatedRelative__</small>',
-       '<small>__ToldRelative__</small>',
-       '<small>__LastUpdatedRelative__</small>',
-       '<small>__TimeLeft__</small>'}); 
-
-AUTHOR
-    Jesse Vincent "<jesse at bestpractical.com>"
-
-LICENCE AND COPYRIGHT
-    Copyright (c) 2007, Best Practical Solutions, LLC. All rights reserved.
-
-    This module is free software; you can redistribute it and/or modify it
-    under the same terms as Perl itself. See perlartistic.
-
-DISCLAIMER OF WARRANTY
-    BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-    FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-    OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-    PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-    EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-    ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
-    YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-    NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
-    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-    REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
-    TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
-    CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-    SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-    RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-    FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-    SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-    DAMAGES.
-
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
new file mode 100644
index 0000000..348531e
--- /dev/null
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -0,0 +1,48 @@
+#line 1
+package Module::Install::ReadmeFromPod;
+
+use 5.006;
+use strict;
+use warnings;
+use base qw(Module::Install::Base);
+use vars qw($VERSION);
+
+$VERSION = '0.12';
+
+sub readme_from {
+  my $self = shift;
+  return unless $self->is_admin;
+
+  my $file = shift || $self->_all_from
+    or die "Can't determine file to make readme_from";
+  my $clean = shift;
+
+  print "Writing README from $file\n";
+
+  require Pod::Text;
+  my $parser = Pod::Text->new();
+  open README, '> README' or die "$!\n";
+  $parser->output_fh( *README );
+  $parser->parse_file( $file );
+  if ($clean) {
+    $self->clean_files('README');
+  }
+  return 1;
+}
+
+sub _all_from {
+  my $self = shift;
+  return unless $self->admin->{extensions};
+  my ($metadata) = grep {
+    ref($_) eq 'Module::Install::Metadata';
+  } @{$self->admin->{extensions}};
+  return unless $metadata;
+  return $metadata->{values}{all_from} || '';
+}
+
+'Readme!';
+
+__END__
+
+#line 112
+

commit 4c5b6f8cd0b4dcc2048b1ab510a680445ff0c21b
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Aug 9 12:32:42 2011 -0400

    Check that a user has DeleteTicket before showing the link

diff --git a/html/Callbacks/RT-Extension-QuickDelete/Elements/RT__Ticket/ColumnMap/ColumnMap b/html/Callbacks/RT-Extension-QuickDelete/Elements/RT__Ticket/ColumnMap/ColumnMap
index 390ab99..5d47354 100644
--- a/html/Callbacks/RT-Extension-QuickDelete/Elements/RT__Ticket/ColumnMap/ColumnMap
+++ b/html/Callbacks/RT-Extension-QuickDelete/Elements/RT__Ticket/ColumnMap/ColumnMap
@@ -6,6 +6,7 @@ $COLUMN_MAP->{'QuickDelete'} = {
     title => ' ',
     value => sub {
         my $ticket = shift;
+        return unless $ticket->CurrentUserHasRight('DeleteTicket');
         return $m->comp( '/RT-Extension-QuickDelete/Toggle',
             id => $ticket->id );
         }
diff --git a/html/Callbacks/RT-Extension-QuickDelete/Ticket/Elements/Tabs/Default b/html/Callbacks/RT-Extension-QuickDelete/Ticket/Elements/Tabs/Default
index 75ce4c4..d8bd9ac 100644
--- a/html/Callbacks/RT-Extension-QuickDelete/Ticket/Elements/Tabs/Default
+++ b/html/Callbacks/RT-Extension-QuickDelete/Ticket/Elements/Tabs/Default
@@ -18,6 +18,7 @@
 
 <%init>
 if ($Ticket) {
+    return unless $Ticket->CurrentUserHasRight('DeleteTicket');
     $actions->{'_ZZ-QuickDelete'} = {
         html => $m->scomp(
             '/RT-Extension-QuickDelete/Toggle',
diff --git a/lib/RT/Extension/QuickDelete.pm b/lib/RT/Extension/QuickDelete.pm
index f0d9ff4..2bd19ea 100644
--- a/lib/RT/Extension/QuickDelete.pm
+++ b/lib/RT/Extension/QuickDelete.pm
@@ -39,10 +39,8 @@ RT::Extension::QuickDelete - Adds a "quick delete" button to RT's standard ticke
    '<small>__LastUpdatedRelative__</small>',
    '<small>__TimeLeft__</small>'}); 
 
-
-
-
-
+On RT 4, this extension will not provide a Quick Delete link from the Ticket Display pages.  You can add one
+using the Lifecycles functionality.
 
 =head1 AUTHOR
 
@@ -51,7 +49,7 @@ Jesse Vincent  C<< <jesse at bestpractical.com> >>
 
 =head1 LICENCE AND COPYRIGHT
 
-Copyright (c) 2007, Best Practical Solutions, LLC.  All rights reserved.
+Copyright (c) 2007-2011, Best Practical Solutions, LLC.  All rights reserved.
 
 This module is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself. See L<perlartistic>.

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



More information about the Bps-public-commit mailing list