Commit 06cfc7ea authored by Kevin Falcone's avatar Kevin Falcone
Browse files

In c1565ef1 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.
parent 39524659
......@@ -4,6 +4,7 @@ use inc::Module::Install;
RTx ('RT-Extension-CommandByMail');
author ('Jesse Vincent <jesse@bestpractical.com>');
license('perl');
readme_from('lib/RT/Extension/CommandByMail.pm');
build_requires('Test::More');
build_requires('IPC::Open2');
......
NAME
RT::Extension::CommandByMail - Change metadata of ticket via email
SYNOPSIS
Status: stalled
Subject: change subject
AddAdminCc: boss@example.com
AddCc: dev1@example.com
AddCc: dev2@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@bestpractical.com>" Ruslan U. Zakirov
"<ruz@bestpractical.com>" Kevin Falcone "<falcone@bestpractical.com>"
Shawn Moore "<sartak@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.
#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
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment