[Bps-public-commit] rt-extension-notificationmatrix branch, master, updated. 2.1-14-g251c429

Jim Brandt jbrandt at bestpractical.com
Wed Oct 19 13:26:48 EDT 2016


The branch, master has been updated
       via  251c42991de4de072844abf43453ff96d0c95a5a (commit)
       via  4f5cc382379ad2f233f97da46899b52b6d7eee42 (commit)
       via  3360dd195d1ab3f0bf5a0ed0c396164ff049d6d8 (commit)
       via  f0f4dd80c5350260136bd4f0f3ca32919f6d97cf (commit)
       via  85ad16d96e173299dc255e90cc32bb723ae66037 (commit)
      from  d2fdd85dba7f874f763e456c088e03c22d2b49a0 (commit)

Summary of changes:
 Changes                                            |  2 +
 MANIFEST                                           |  8 ++-
 META.yml                                           |  4 +-
 inc/Module/Install/RTx.pm                          | 29 +++++++--
 inc/Module/Install/ReadmeFromPod.pm                | 76 +++++++++++++++++-----
 lib/RT/Extension/NotificationMatrix.pm             |  2 +-
 .../NotificationMatrix/Rule/TicketTaken.pm         |  5 +-
 7 files changed, 101 insertions(+), 25 deletions(-)
 create mode 100644 Changes

- Log -----------------------------------------------------------------
commit 85ad16d96e173299dc255e90cc32bb723ae66037
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Oct 11 17:04:18 2016 -0400

    Module::Install updates

diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 97acf77..80538d3 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.37';
+our $VERSION = '0.38';
 
 use FindBin;
 use File::Glob     ();
@@ -37,6 +37,13 @@ sub RTx {
     }
     $self->add_metadata("x_module_install_rtx_version", $VERSION );
 
+    my $installdirs = $ENV{INSTALLDIRS};
+    for ( @ARGV ) {
+        if ( /INSTALLDIRS=(.*)/ ) {
+            $installdirs = $1;
+        }
+    }
+
     # Try to find RT.pm
     my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4);
     $ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME};
@@ -71,7 +78,13 @@ sub RTx {
 
     # Installation locations
     my %path;
-    $path{$_} = $RT::LocalPluginPath . "/$name/$_"
+    my $plugin_path;
+    if ( $installdirs && $installdirs eq 'vendor' ) {
+        $plugin_path = $RT::PluginPath;
+    } else {
+        $plugin_path = $RT::LocalPluginPath;
+    }
+    $path{$_} = $plugin_path . "/$name/$_"
         foreach @DIRS;
 
     # Copy RT 4.2.0 static files into NoAuth; insufficient for
@@ -85,7 +98,7 @@ sub RTx {
     my %index = map { $_ => 1 } @INDEX_DIRS;
     $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
 
-    my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
+    my $args = join ', ', map "q($_)", map { ($_, "\$(DESTDIR)$path{$_}") }
         sort keys %path;
 
     printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
@@ -131,6 +144,7 @@ install ::
     if ( $path{lib} ) {
         $self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
         $self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
+        $self->makemaker_args( INSTALLVENDORLIB => $path{'lib'} )
     } else {
         $self->makemaker_args( PM => { "" => "" }, );
     }
@@ -139,6 +153,13 @@ install ::
     $self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
     $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
 
+    # INSTALLDIRS=vendor should install manpages into /usr/share/man.
+    # That is the default path in most distributions. Need input from
+    # Redhat, Centos etc.
+    $self->makemaker_args( INSTALLVENDORMAN1DIR => "/usr/share/man/man1" );
+    $self->makemaker_args( INSTALLVENDORMAN3DIR => "/usr/share/man/man3" );
+    $self->makemaker_args( INSTALLVENDORARCH => "/usr/share/man" );
+
     if (%has_etc) {
         print "For first-time installation, type 'make initdb'.\n";
         my $initdb = '';
@@ -258,4 +279,4 @@ sub _load_rt_handle {
 
 __END__
 
-#line 390
+#line 428
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index b5e03c3..3634ee0 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,12 +7,41 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.22';
+$VERSION = '0.26';
+
+{
+
+    # these aren't defined until after _require_admin is run, so
+    # define them so prototypes are available during compilation.
+    sub io;
+    sub capture(&;@);
+
+#line 28
+
+    my $done = 0;
+
+    sub _require_admin {
+
+	# do this once to avoid redefinition warnings from IO::All
+	return if $done;
+
+	require IO::All;
+	IO::All->import( '-binary' );
+
+	require Capture::Tiny;
+	Capture::Tiny->import ( 'capture' );
+
+	return;
+    }
+
+}
 
 sub readme_from {
   my $self = shift;
   return unless $self->is_admin;
 
+  _require_admin;
+
   # Input file
   my $in_file  = shift || $self->_all_from
     or die "Can't determine file to make readme_from";
@@ -50,6 +79,8 @@ sub readme_from {
     $out_file = $self->_readme_htm($in_file, $out_file, $options);
   } elsif ($format eq 'man') {
     $out_file = $self->_readme_man($in_file, $out_file, $options);
+  } elsif ($format eq 'md') {
+    $out_file = $self->_readme_md($in_file, $out_file, $options);
   } elsif ($format eq 'pdf') {
     $out_file = $self->_readme_pdf($in_file, $out_file, $options);
   }
@@ -67,10 +98,10 @@ sub _readme_txt {
   $out_file ||= 'README';
   require Pod::Text;
   my $parser = Pod::Text->new( @$options );
-  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
   $parser->output_fh( *$out_fh );
   $parser->parse_file( $in_file );
-  close $out_fh;
   return $out_file;
 }
 
@@ -79,11 +110,14 @@ sub _readme_htm {
   my ($self, $in_file, $out_file, $options) = @_;
   $out_file ||= 'README.htm';
   require Pod::Html;
-  Pod::Html::pod2html(
-    "--infile=$in_file",
-    "--outfile=$out_file",
-    @$options,
-  );
+  my ($o) = capture {
+    Pod::Html::pod2html(
+      "--infile=$in_file",
+      "--outfile=-",
+      @$options,
+    );
+  };
+  io->file($out_file)->print($o);
   # Remove temporary files if needed
   for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
     if (-e $file) {
@@ -99,7 +133,10 @@ sub _readme_man {
   $out_file ||= 'README.1';
   require Pod::Man;
   my $parser = Pod::Man->new( @$options );
-  $parser->parse_from_file($in_file, $out_file);
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
   return $out_file;
 }
 
@@ -111,11 +148,20 @@ sub _readme_pdf {
     or die "Could not generate $out_file because pod2pdf could not be found\n";
   my $parser = App::pod2pdf->new( @$options );
   $parser->parse_from_file($in_file);
-  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
-  select $out_fh;
-  $parser->output;
-  select STDOUT;
-  close $out_fh;
+  my ($o) = capture { $parser->output };
+  io->file($out_file)->print($o);
+  return $out_file;
+}
+
+sub _readme_md {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.md';
+  require Pod::Markdown;
+  my $parser = Pod::Markdown->new( @$options );
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
   return $out_file;
 }
 
@@ -134,5 +180,5 @@ sub _all_from {
 
 __END__
 
-#line 254
+#line 316
 

commit f0f4dd80c5350260136bd4f0f3ca32919f6d97cf
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Oct 11 17:05:15 2016 -0400

    Limit Taken rule to Set transactions
    
    The SetWatcher transaction was added in f2f00cf18 and that
    transaction matches the current rules for the TicketTaken
    notification. This results in two notifications, one for the Set
    and one for the SetWatcher. Add a check only for the Set
    transaction.

diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
index dee5652..9dbf50c 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
@@ -10,7 +10,8 @@ sub ConditionMatched {
     my $self = shift;
     my $txn = $self->TransactionObj;
 
-    return ($txn->Field && $txn->Field eq 'Owner' && $txn->OldValue == $RT::Nobody->Id)
+    # Limit to Set so we don't notify on a SetWatcher transaction
+    return ($txn->Field && $txn->Field eq 'Owner' && $txn->Type eq 'Set' && $txn->OldValue == $RT::Nobody->Id)
 }
 
 =head Templates

commit 3360dd195d1ab3f0bf5a0ed0c396164ff049d6d8
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Oct 11 17:08:53 2016 -0400

    Prep for 3.01 release

diff --git a/Changes b/Changes
new file mode 100644
index 0000000..b18a5a2
--- /dev/null
+++ b/Changes
@@ -0,0 +1,2 @@
+3.01 2016-10-11
+ - Limit TicketTaken to Set transaction to avoid duplicate notifications
diff --git a/MANIFEST b/MANIFEST
index 9f272da..17f9a7a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,15 +1,20 @@
+Changes
 doc/rules-and-usage
 html/Admin/Queues/NotificationMatrix.html
-html/Callbacks/NotificationMatrix/Admin/Elements/QueueTabs/Default
+html/Callbacks/NotificationMatrix/Elements/Tabs/Privileged
 inc/Module/Install.pm
 inc/Module/Install/Base.pm
 inc/Module/Install/Can.pm
 inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
+inc/Module/Install/ReadmeFromPod.pm
 inc/Module/Install/RTx.pm
+inc/Module/Install/RTx/Runtime.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
+inc/YAML/Tiny.pm
 lib/RT/Extension/NotificationMatrix.pm
 lib/RT/Extension/NotificationMatrix/Rule.pm
 lib/RT/Extension/NotificationMatrix/Rule/QueueChanged.pm
@@ -22,4 +27,5 @@ lib/RT/Extension/NotificationMatrix/Rule/TicketUpdatedExternally.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml
+README
 t/basic.t
diff --git a/META.yml b/META.yml
index 5d0c124..ab55fec 100644
--- a/META.yml
+++ b/META.yml
@@ -19,6 +19,6 @@ no_index:
     - t
 requires:
   perl: 5.10.1
-version: '3.0'
-x_module_install_rtx_version: '0.37'
+version: '3.01'
+x_module_install_rtx_version: '0.38'
 x_requires_rt: 4.2.0
diff --git a/lib/RT/Extension/NotificationMatrix.pm b/lib/RT/Extension/NotificationMatrix.pm
index 29d3f2c..cceb714 100644
--- a/lib/RT/Extension/NotificationMatrix.pm
+++ b/lib/RT/Extension/NotificationMatrix.pm
@@ -2,7 +2,7 @@ use warnings;
 use strict;
 
 package RT::Extension::NotificationMatrix;
-our $VERSION = '3.0';
+our $VERSION = '3.01';
 
 RT::Ruleset->Add(
     Name => 'NotificationMatrix',

commit 4f5cc382379ad2f233f97da46899b52b6d7eee42
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Oct 19 13:22:46 2016 -0400

    Modify taken rule to notify on all owner changes
    
    Notify on all owner changes, not just changes from Nobody
    to a user.

diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
index 9dbf50c..8cd8773 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
@@ -4,14 +4,14 @@ use warnings;
 use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketTaken';
-use constant Description => 'When ticket is taken';
+use constant Description => 'When owner is changed';
 
 sub ConditionMatched {
     my $self = shift;
     my $txn = $self->TransactionObj;
 
     # Limit to Set so we don't notify on a SetWatcher transaction
-    return ($txn->Field && $txn->Field eq 'Owner' && $txn->Type eq 'Set' && $txn->OldValue == $RT::Nobody->Id)
+    return ($txn->Field && $txn->Field eq 'Owner' && $txn->Type eq 'Set' && $txn->OldValue != $txn->NewValue)
 }
 
 =head Templates

commit 251c42991de4de072844abf43453ff96d0c95a5a
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Oct 19 13:25:52 2016 -0400

    Prep for 3.02 release

diff --git a/META.yml b/META.yml
index ab55fec..e703bba 100644
--- a/META.yml
+++ b/META.yml
@@ -19,6 +19,6 @@ no_index:
     - t
 requires:
   perl: 5.10.1
-version: '3.01'
+version: '3.02'
 x_module_install_rtx_version: '0.38'
 x_requires_rt: 4.2.0
diff --git a/lib/RT/Extension/NotificationMatrix.pm b/lib/RT/Extension/NotificationMatrix.pm
index cceb714..53f8a6f 100644
--- a/lib/RT/Extension/NotificationMatrix.pm
+++ b/lib/RT/Extension/NotificationMatrix.pm
@@ -2,7 +2,7 @@ use warnings;
 use strict;
 
 package RT::Extension::NotificationMatrix;
-our $VERSION = '3.01';
+our $VERSION = '3.02';
 
 RT::Ruleset->Add(
     Name => 'NotificationMatrix',

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


More information about the Bps-public-commit mailing list