[Bps-public-commit] RT-Extension-CommandByMail branch, master, updated. 0.15-2-g0830350

Kevin Falcone falcone at bestpractical.com
Fri Oct 25 15:47:26 EDT 2013


The branch, master has been updated
       via  0830350b023f32e60fec33af3261a94f20cb05fb (commit)
       via  06cfc7ea6a3c554751bc9432a8bbdfe585d9f15e (commit)
      from  3952465984698dc519342a409275b4319c562b65 (commit)

Summary of changes:
 Changes                             |   2 +
 MANIFEST                            |   8 +-
 META.yml                            |   4 +-
 Makefile.PL                         |   3 +-
 README                              | 167 ++++++++++++++++--------------------
 inc/Module/Install/RTx.pm           |  29 +------
 inc/Module/Install/ReadmeFromPod.pm | 138 +++++++++++++++++++++++++++++
 lib/RT/Extension/CommandByMail.pm   |  18 +++-
 8 files changed, 239 insertions(+), 130 deletions(-)
 create mode 100644 inc/Module/Install/ReadmeFromPod.pm

- Log -----------------------------------------------------------------
commit 06cfc7ea6a3c554751bc9432a8bbdfe585d9f15e
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Oct 25 13:49:14 2013 -0400

    In c1565ef15 we refactored INSTALL/README but didn't regen README
    
    Start auto-generating from the lib file, like we do for most other
    extensions these day.  Now the README tells you about the config options
    and points you off to the 'one true place' for commands a few times.

diff --git a/Makefile.PL b/Makefile.PL
index 7fa6fcd..cd2fc3c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,6 +4,7 @@ use inc::Module::Install;
 RTx ('RT-Extension-CommandByMail');
 author ('Jesse Vincent <jesse at bestpractical.com>');
 license('perl');
+readme_from('lib/RT/Extension/CommandByMail.pm');
 
 build_requires('Test::More');
 build_requires('IPC::Open2');
diff --git a/README b/README
index c6c404d..7ba5df2 100644
--- a/README
+++ b/README
@@ -1,103 +1,88 @@
+NAME
+    RT::Extension::CommandByMail - Change metadata of ticket via email
+
+SYNOPSIS
+        Status: stalled
+        Subject: change subject
+        AddAdminCc: boss at example.com
+        AddCc: dev1 at example.com
+        AddCc: dev2 at example.com
+
+        The comment/reply text goes here
+
+DESCRIPTION
+    This extension allows you to manage tickets via email interface. You may
+    put commands into the beginning of a mail, and extension will apply
+    them. See the list of commands in the
+    RT::Interface::Email::Filter::TakeAction docs.
+
+    CAVEAT: commands are line oriented, so you can't expand to multiple
+    lines for each command, i.e. values can't contains new lines. The module
+    also currently expects and parses text, not HTML.
+
+SECURITY
+    This extension has no extended auth system; so all security issues that
+    apply to the RT in general also apply to the extension.
+
 INSTALLATION
+    "perl Makefile.PL"
+    "make"
+    "make install"
+        May need root permissions
 
-Read INSTALL file to get more info about installation.
+    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+        Add this line:
 
-COPYRIGHT AND LICENCE
+            Set(@Plugins, ( @Plugins, "RT::Extension::CommandByMail" ));
 
-Copyright (C) 2006, Best Practical Solutions LLC.
+        As well as:
 
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+            Set(@MailPlugins, qw(Auth::MailFrom Filter::TakeAction));
 
-DESCRIPTION
-    This extension parses the body and headers of incoming messages
-    for list commands. Format of commands is:
+        If you already have a @MailPlugins configuration line, add
+        "Filter::TakeAction" after any authentication plugins (such as
+        "Auth::MailFrom" or "Auth::Crypt").
+
+    Restart your webserver
+
+CONFIGURATION
+  $CommandByMailGroup
+    You may set a $CommandByMailGroup to a particular group ID in
+    RT_SiteConfig. If set, only members of this group may perform commands
+    by mail.
+
+  $CommandByMailHeader
+    You may set this configuration value to the name of a header to examine
+    as well. For example:
+
+        Set($CommandByMailHeader, "X-RT-Command");
+
+  $CommandByMailOnlyHeaders
+    If set, the body will not be examined, only the headers.
+
+COMMANDS
+    This extension parses the body and headers of incoming messages for list
+    commands. Format of commands is:
 
         Command: value
         Command: value
         ...
 
-    You can find list of "COMMANDS commands below".
-
-    Some commands (like Status, Queue and other) can be used only once.
-    Commands that manage lists can be used multiple times, for example link,
-    custom fields and watchers commands. Also, the latter can be used with
-    "Add" and "Del" prefixes to add/delete values from the current list of
-    the ticket you reply to or comment on.
-
-  COMMANDS
-   Basic
-    Queue: <name>
-        Set new queue for the ticket
-
-    Subject: <string>
-        Set new subject to the given string
-
-    Status: <status>
-        Set new status, one of new, open, stalled, resolved, rejected or
-        deleted
-
-    Owner: <username>
-        Set new owner using the given username
-
-    Priority: <#>
-        Set new priority to the given value
-
-    FinalPriority: <#>
-        Set new final priority to the given value
-
-   Dates
-    Set new date/timestamp, or 0 to unset:
-
-        Due: <new timestamp>
-        Starts: <new timestamp>
-        Started: <new timestamp>
-
-   Time
-    Set new times to the given value in minutes. Note that on
-    correspond/comment "TimeWorked" add time to the current value.
-
-        TimeWorked: <minutes>
-        TimeEstimated: <minutes>
-        TimeLeft: <minutes>
-
-   Watchers
-    Manage watchers: requestors, ccs and admin ccs. This commands can be
-    used several times and/or with "Add" and "Del" prefixes, for example
-    "Requestor" comand set requestor(s) and the current requestors would be
-    deleted, but "AddRequestor" command adds to the current list.
-
-        Requestor: <address> Set requestor(s) using the email address
-        AddRequestor: <address> Add new requestor using the email address
-        DelRequestor: <address> Remove email address as requestor
-        Cc: <address> Set Cc watcher(s) using the email address
-        AddCc: <address> Add new Cc watcher using the email address
-        DelCc: <address> Remove email address as Cc watcher
-        AdminCc: <address> Set AdminCc watcher(s) using the email address
-        AddAdminCc: <address> Add new AdminCc watcher using the email address
-        DelAdminCc: <address> Remove email address as AdminCc watcher
-
-   Links
-    Manage links. These commands are also could be used several times in one
-    message.
-
-        DependsOn: <ticket id>
-        DependedOnBy: <ticket id>
-        RefersTo: <ticket id>
-        ReferredToBy: <ticket id>
-        Members: <ticket id>
-        MemberOf: <ticket id>
-
-   Custom field values
-    Manage custom field values. Could be used multiple times.
-
-        CustomField.{CFName}: <custom field value>
-        AddCustomField.{CFName}: <custom field value>
-        DelCustomField.{CFName}: <custom field value>
-
-    Short forms:
-
-        CF.{CFName}: <custom field value>
-        AddCF.{CFName}: <custom field value>
-        DelCF.{CFName}: <custom field value>
+    See the list of commands in the RT::Interface::Email::Filter::TakeAction
+    docs.
+
+CAVEATS
+    This extension is incompatible with "UnsafeEmailCommands" RT option.
+
+AUTHOR
+    Jesse Vincent "<jesse at bestpractical.com>" Ruslan U. Zakirov
+    "<ruz at bestpractical.com>" Kevin Falcone "<falcone at bestpractical.com>"
+    Shawn Moore "<sartak at bestpractical.com>"
+
+LICENCE AND COPYRIGHT
+    Copyright (c) 2006-2013, 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.
 
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
new file mode 100644
index 0000000..6a80818
--- /dev/null
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -0,0 +1,138 @@
+#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.20';
+
+sub readme_from {
+  my $self = shift;
+  return unless $self->is_admin;
+
+  # Input file
+  my $in_file  = shift || $self->_all_from
+    or die "Can't determine file to make readme_from";
+
+  # Get optional arguments
+  my ($clean, $format, $out_file, $options);
+  my $args = shift;
+  if ( ref $args ) {
+    # Arguments are in a hashref
+    if ( ref($args) ne 'HASH' ) {
+      die "Expected a hashref but got a ".ref($args)."\n";
+    } else {
+      $clean    = $args->{'clean'};
+      $format   = $args->{'format'};
+      $out_file = $args->{'output_file'};
+      $options  = $args->{'options'};
+    }
+  } else {
+    # Arguments are in a list
+    $clean    = $args;
+    $format   = shift;
+    $out_file = shift;
+    $options  = \@_;
+  }
+
+  # Default values;
+  $clean  ||= 0;
+  $format ||= 'txt';
+
+  # Generate README
+  print "readme_from $in_file to $format\n";
+  if ($format =~ m/te?xt/) {
+    $out_file = $self->_readme_txt($in_file, $out_file, $options);
+  } elsif ($format =~ m/html?/) {
+    $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 'pdf') {
+    $out_file = $self->_readme_pdf($in_file, $out_file, $options);
+  }
+
+  if ($clean) {
+    $self->clean_files($out_file);
+  }
+
+  return 1;
+}
+
+
+sub _readme_txt {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $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";
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  close $out_fh;
+  return $out_file;
+}
+
+
+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,
+  );
+  # Remove temporary files if needed
+  for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
+    if (-e $file) {
+      unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
+    }
+  }
+  return $out_file;
+}
+
+
+sub _readme_man {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.1';
+  require Pod::Man;
+  my $parser = Pod::Man->new( @$options );
+  $parser->parse_from_file($in_file, $out_file);
+  return $out_file;
+}
+
+
+sub _readme_pdf {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.pdf';
+  eval { require App::pod2pdf; }
+    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;
+  return $out_file;
+}
+
+
+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 254
+
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index c3dcd66..e4a0dba 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -23,12 +23,13 @@ RT::Extension::CommandByMail - Change metadata of ticket via email
 =head1 DESCRIPTION
 
 This extension allows you to manage tickets via email interface.  You
-may put commands into beginning of a mail, and extension will apply
+may put commands into the beginning of a mail, and extension will apply
 them. See the list of commands in the
 L<RT::Interface::Email::Filter::TakeAction> docs.
 
 B<CAVEAT:> commands are line oriented, so you can't expand to multiple
-lines for each command, i.e. values can't contains new lines.
+lines for each command, i.e. values can't contains new lines. The module
+also currently expects and parses text, not HTML.
 
 =head1 SECURITY
 
@@ -83,6 +84,17 @@ as well.  For example:
 
 If set, the body will not be examined, only the headers.
 
+=head1 COMMANDS
+
+This extension parses the body and headers of incoming messages
+for list commands. Format of commands is:
+
+    Command: value
+    Command: value
+    ...
+
+See the list of commands in the L<RT::Interface::Email::Filter::TakeAction> docs.
+
 =head1 CAVEATS
 
 This extension is incompatible with C<UnsafeEmailCommands> RT option.

commit 0830350b023f32e60fec33af3261a94f20cb05fb
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Oct 25 13:54:29 2013 -0400

    Release Engineering for 0.16

diff --git a/Changes b/Changes
index e863c2d..1943761 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,6 @@
 Revision history for RT-Extension-CommandByMail
+0.15    Fri Oct 25 2013
+* Finish updating the README that ships with the extension
 
 0.15    Thu Oct  3 14:49:17 EDT 2013
 * no_index for RT::Extension::CommandByMail::test
diff --git a/MANIFEST b/MANIFEST
index 59b93e9..2664de7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -8,23 +8,17 @@ 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/Substitute.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
-INSTALL
 lib/RT/Extension/CommandByMail.pm
 lib/RT/Extension/CommandByMail/Test.pm
 lib/RT/Interface/Email/Filter/TakeAction.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml
-patch/command_by_email-0.1-RT-3.4.2.patch
-patch/command_by_email-0.1-RT-3.4.3.patch
-patch/command_by_email-0.1-RT-3.4.4.patch
-patch/command_by_email-0.1-RT-3.4.5.patch
-patch/command_by_email-0.1-RT-3.6.0.patch
-patch/errors_in_reply_to-RT-3.6.1.patch
 README
 t/create.t
 t/internals.t
diff --git a/META.yml b/META.yml
index 0bc2ac5..fc088d6 100644
--- a/META.yml
+++ b/META.yml
@@ -2,7 +2,7 @@
 abstract: 'Change metadata of ticket via email'
 author:
   - 'Jesse Vincent  C<< <jesse at bestpractical.com> >>'
-  - 'Jesse Vincent <jesse at bestpractical.com>'
+  - 'Jesse Vincent  C<< <jesse at bestpractical.com> >>'
 build_requires:
   ExtUtils::MakeMaker: 6.59
   IPC::Open2: 0
@@ -29,4 +29,4 @@ requires:
   perl: 5.8.3
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.15
+version: 0.16
diff --git a/Makefile.PL b/Makefile.PL
index cd2fc3c..1add874 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,7 +2,7 @@ use inc::Module::Install;
 
 #die "This RT Extension will kill your pets and steal your valuables. DO NOT USE IT YET";
 RTx ('RT-Extension-CommandByMail');
-author ('Jesse Vincent <jesse at bestpractical.com>');
+author_from ('lib/RT/Extension/CommandByMail.pm');
 license('perl');
 readme_from('lib/RT/Extension/CommandByMail.pm');
 
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..434a73d 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -174,37 +174,14 @@ 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;
+    require RT::Handle;
+    my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
         # should we die?
@@ -216,4 +193,4 @@ sub requires_rt {
 
 __END__
 
-#line 336
+#line 313
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index e4a0dba..00c8e05 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -1,7 +1,7 @@
 use 5.008003;
 package RT::Extension::CommandByMail;
 
-our $VERSION = '0.15';
+our $VERSION = '0.16';
 
 1;
 __END__

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



More information about the Bps-public-commit mailing list