[Bps-public-commit] r18554 - in RTx-WorkflowBuilder: bin lib/RTx

clkao at bestpractical.com clkao at bestpractical.com
Tue Feb 24 03:07:36 EST 2009


Author: clkao
Date: Tue Feb 24 03:07:36 2009
New Revision: 18554

Added:
   RTx-WorkflowBuilder/Changes
   RTx-WorkflowBuilder/README
Modified:
   RTx-WorkflowBuilder/MANIFEST
   RTx-WorkflowBuilder/Makefile.PL
   RTx-WorkflowBuilder/bin/rt-workflow
   RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm

Log:
1.02.

Added: RTx-WorkflowBuilder/Changes
==============================================================================
--- (empty file)
+++ RTx-WorkflowBuilder/Changes	Tue Feb 24 03:07:36 2009
@@ -0,0 +1,5 @@
+Revision history for RTx-WorkflowBuilder
+
+1.02  Tue Feb 24 16:06:37 CST 2009
+       Initial CPAN release.
+

Modified: RTx-WorkflowBuilder/MANIFEST
==============================================================================
--- RTx-WorkflowBuilder/MANIFEST	(original)
+++ RTx-WorkflowBuilder/MANIFEST	Tue Feb 24 03:07:36 2009
@@ -9,7 +9,9 @@
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/RTx/WorkflowBuilder.pm
+Changes
 Makefile.PL
 MANIFEST			This list of files
 META.yml
+README
 t/basic.t

Modified: RTx-WorkflowBuilder/Makefile.PL
==============================================================================
--- RTx-WorkflowBuilder/Makefile.PL	(original)
+++ RTx-WorkflowBuilder/Makefile.PL	Tue Feb 24 03:07:36 2009
@@ -8,4 +8,6 @@
 version_from    ('lib/RTx//WorkflowBuilder.pm');
 license         ('GPL version 2');
 
+requires        ('Class::Accessor::Fast');
+
 &WriteAll;

Added: RTx-WorkflowBuilder/README
==============================================================================
--- (empty file)
+++ RTx-WorkflowBuilder/README	Tue Feb 24 03:07:36 2009
@@ -0,0 +1,51 @@
+RTx::WorkflowBuilder is a tool for configuring approval workflow in RT.
+
+Best Practical sells support and customization for RT.  Feel free to
+contact us at sales at bestpractical.com if you have any questions about
+our service offerings.
+
+
+Installation instructions:
+--------------------------
+
+1) Install RT 3.8.2 or newer.
+
+2) Once RT appears to be happily installed, cd into the directory
+   where you unpacked RTx::WorkflowBuilder.
+
+3) perl Makefile.PL
+
+4) make install
+
+Further reading:
+-----------------------------------------------------
+
+perldoc bin/rt-workflow - quick overview and configuration
+
+Development
+------------------------------------------------------
+
+If you would like to run RTx::WorkflowBuilder's tests, you need to
+set a few environment variables
+RT_DBA_USER - a user who can create a database on your 
+              RDBMS (such as root on mysql)
+RT_DBA_PASSWORD - the password for RT_DBA_USER
+PERL5LIB - the path to your RT libraries (/opt/rt3/lib)
+
+RT_DBA_USER=user RT_DBA_PASSWORD=password PERL5LIB=/opt/rt3/lib make test
+
+These are intended to be run before installing RTx::WorkflowBuilder.
+Like RT, RTx::WorkflowBuilder expects to be able to create a new
+database called rt3test on your system.
+
+Bug reporting and discussion lists:
+-----------------------------------------------------
+
+You probably want to discuss RTx::WorkflowBuilder on
+rt-users at lists.bestpractical.com.  (Send mail to
+rt-users-request at lists.fsck.com to subscribe)
+
+Bug reports can be sent to bugs-rtx-workflowbuilder at bestpractical.com. 
+You can look at open bug reports at
+https://rt.cpan.org/Public/Dist/Display.html?Name=RTx-WorkflowBuilder.
+Log in as guest/guest to see the content of bug reports.

Modified: RTx-WorkflowBuilder/bin/rt-workflow
==============================================================================
--- RTx-WorkflowBuilder/bin/rt-workflow	(original)
+++ RTx-WorkflowBuilder/bin/rt-workflow	Tue Feb 24 03:07:36 2009
@@ -1,13 +1,97 @@
-#!/usr/bin/perl -w
+#!perl -w
 use strict;
 use warnings;
 use Getopt::Long;
 use RTx::WorkflowBuilder;
 
-my ($queue, $wf_name) = @ARGV;
+=head1 NAME
+
+rt-workflow - helper for configuring approval workflow in RT
+
+=head1 SYNOPSIS
+
+In your RT_SiteConfig.pm:
+
+  Set( $WorkflowBuilderStages,
+       { 'Manager approval' =>
+         { content => '.....',
+           subject => 'Manager Approval for PO: {$Approving->Id} - {$Approving->Subject}',
+
+           owner => q!{{
+    Fire                => "moss",
+    IT                  => "roy",
+    Marketing           => "jen"}->{ $Approving->FirstCustomFieldValue('Department') }}! },
+         'Finance approval' =>
+         { content => '... ',
+           owner => 'CFO',
+         },
+         'CEO approval' =>
+         { content => '..........',
+           owner => 'CEO',
+         }});
+
+  Set( $WorkflowBuilderRules,
+  { 'PO-Approval' => [ 'Manager approval' => 'Finance approval' => 'CEO approval'],
+    'Vacation-Approval' => [ 'Manager approval' => 'CEO approval']
+ }
+);
+
+# to enable the workflow rules described in "PO-Approval" for the PO queue:
+% bin/rt-workflow PO PO-Approval --create
+
+# to update the workflow associated with the PO queue once you changed
+# the configuration
+% bin/rt-workflow PO PO-Approval
+
+=head1 DESCRIPTION
+
+This module allows you to define approval stages and approval rules in
+your F<RT_SiteConfig.pm> and builds the appropriate scrips for you.
+
+=over
+
+=item $WorkflowBuilderStages
+
+The config value should be a hashref, with keys being the name of the
+approval stage, and values being a hashref of the approval
+specification, which can include the usual fields for ticket such as
+owner, subject.  note that the values can be interpolated just like
+normal RT Template (escaped with C<{}>), and you can access the ticket to
+be approved with the variable C<$Approving>.
+
+=item $WorkflowBuilderRules
+
+The config value should be a hashref, with keys being the name of the
+approval rule, and the values being arrayref denoting the stages of
+the approval in the suitable order.
+
+A stage with parallel approvals where any of them can move the
+approval workflow to next stage, can be represented as another
+arrayref in the approval chain.  For example:
+
+  ['Manager approval' => 'Financial approval' => 'CEO approval']
+
+implies a monotonous approval chain that goes from manager to
+financial, and finally to CEO.
+
+  ['Manager approval' => ['HR', 'VP'] => 'CEO approval']
+
+implies after manager approval, either one of HR or VP approval will
+make it go to CEO approval.
+
+=back
+
+=cut
 
 my %opts;
-GetOptions( \%opts, "create" );
+GetOptions( \%opts, "create", "help" );
+
+if ($opts{help}) {
+    system("perldoc", $0);
+    exit;
+}
+
+my ($queue, $wf_name) = @ARGV or die "Usage: $0 queue workflowname\n";
 
 use RT::Interface::CLI qw(CleanEnv
                           GetCurrentUser GetMessageContent);

Modified: RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm
==============================================================================
--- RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm	(original)
+++ RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm	Tue Feb 24 03:07:36 2009
@@ -4,7 +4,17 @@
 use warnings;
 __PACKAGE__->mk_accessors(qw(stages rule));
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
+
+=head1 NAME
+
+RTx::WorkflowBuilder - helper for configuring approval workflow in RT
+
+=head1 SYNOPSIS
+
+# see rt-workflow
+
+=cut
 
 sub get_stage_object {
     my ($self, $stage, $previous, $approving) = @_;



More information about the Bps-public-commit mailing list