[Bps-public-commit] RT-Extension-CommandByMail branch, master, updated. 2.03-4-gdb8985f

Shawn Moore shawn at bestpractical.com
Fri Sep 9 13:45:29 EDT 2016


The branch, master has been updated
       via  db8985f0a3ab4d84b2b0b0850bee502c223fc492 (commit)
      from  d0aa7188a03ae994d6cb46a8f8c116b219603d70 (commit)

Summary of changes:
 Changes                             |  2 +-
 MANIFEST                            |  2 +
 META.yml                            |  2 +-
 inc/Module/Install/RTx.pm           |  2 +-
 inc/Module/Install/ReadmeFromPod.pm | 76 +++++++++++++++++++++++++++++--------
 5 files changed, 66 insertions(+), 18 deletions(-)

- Log -----------------------------------------------------------------
commit db8985f0a3ab4d84b2b0b0850bee502c223fc492
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Sep 9 17:44:23 2016 +0000

    3.00 releng

diff --git a/Changes b/Changes
index a10aadf..78820f3 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-3.00 2016-09-08
+3.00 2016-09-09
  - Change default behavior for unknown commands: Unknown commands no longer
    generate an unknown command email. There will be a warning in the logs
    whenever an ignored command is encountered.
diff --git a/MANIFEST b/MANIFEST
index c60d608..8537cae 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -18,6 +18,7 @@ inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 inc/YAML/Tiny.pm
 lib/RT/Extension/CommandByMail.pm
+lib/RT/Extension/CommandByMail/Test.pm
 lib/RT/Extension/CommandByMail/Test.pm.in
 lib/RT/Interface/Email/Action/CommandByMail.pm
 lib/RT/Interface/Email/Filter/TakeAction.pm
@@ -27,5 +28,6 @@ META.yml
 README
 xt/create.t
 xt/internals.t
+xt/tmp/ports
 xt/txn-cfs.t
 xt/update.t
diff --git a/META.yml b/META.yml
index 1427460..ec67c80 100644
--- a/META.yml
+++ b/META.yml
@@ -30,5 +30,5 @@ resources:
   license: http://opensource.org/licenses/gpl-license.php
   repository: https://github.com/bestpractical/rt-extension-commandbymail
 version: '3.00'
-x_module_install_rtx_version: '0.37'
+x_module_install_rtx_version: '0.38'
 x_requires_rt: 4.0.0
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index cb4cfde..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     ();
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
 

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


More information about the Bps-public-commit mailing list