[Rt-commit] r3123 - in RT-Action-ExtractSubjectTag: . t
kevinr at bestpractical.com
kevinr at bestpractical.com
Thu Jun 9 02:18:49 EDT 2005
Author: kevinr
Date: Thu Jun 9 02:18:49 2005
New Revision: 3123
Modified:
RT-Action-ExtractSubjectTag/ (props changed)
RT-Action-ExtractSubjectTag/t/01extract_tags.t
RT-Action-ExtractSubjectTag/t/02custom_tags.t
Log:
r4117 at SAD-GIRL-IN-SNOW: kevinr | 2005-06-09 02:18:21 -0400
* Now does the clever thing and only adds the action and scrip to the database
if it can't load them.
Modified: RT-Action-ExtractSubjectTag/t/01extract_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/01extract_tags.t (original)
+++ RT-Action-ExtractSubjectTag/t/01extract_tags.t Thu Jun 9 02:18:49 2005
@@ -24,27 +24,31 @@
### set up the action and the scrip ###
-# add the action to the database
+# check if the action is installed, and if not add it to the database
my $action = RT::ScripAction->new($RT::SystemUser);
-($id, $message) = $action->Create( Name => 'ExtractSubjectTag',
- Description => '',
- ExecModule => 'ExtractSubjectTag',
- );
+($id, $message) = $action->Load('ExtractSubjectTag');
+if (!$id) {
+ ($id, $message) = $action->Create( Name => 'ExtractSubjectTag',
+ Description => '',
+ ExecModule => 'ExtractSubjectTag',
+ );
+}
ok ($id, "create action? " . $message);
-# add the scrip to the database
-
+# check if the scrip is installed, and if not add it to the database
my $scrip = RT::Scrip->new($RT::SystemUser);
-($id, $message)
- = $scrip->Create(
- Description => 'OnTransactionExtractSubjectTag',
- Queue => 0,
- ScripCondition => 'On Transaction',
- ScripAction => 'ExtractSubjectTag',
- Template => 'Blank',
- Stage => 'TransactionCreate',
- );
-#ok ($scrip->Description eq 'OnTransactionExtractSubjectTag', 'can create scrip');
+($id, $message) = $scrip->Load('OnTransactionExtractSubjectTag');
+if (!$id) {
+ ($id, $message)
+ = $scrip->Create(
+ Description => 'OnTransactionExtractSubjectTag',
+ Queue => 0,
+ ScripCondition => 'On Transaction',
+ ScripAction => 'ExtractSubjectTag',
+ Template => 'Blank',
+ Stage => 'TransactionCreate',
+ );
+}
ok ($id, "create scrip? " . $message);
### test default action (extract other RT instances' tags) ###
Modified: RT-Action-ExtractSubjectTag/t/02custom_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/02custom_tags.t (original)
+++ RT-Action-ExtractSubjectTag/t/02custom_tags.t Thu Jun 9 02:18:49 2005
@@ -24,27 +24,31 @@
### set up the action and the scrip ###
-# add the action to the database
+# check if the action is installed, and if not add it to the database
my $action = RT::ScripAction->new($RT::SystemUser);
-($id, $message) = $action->Create( Name => 'ExtractSubjectTag',
- Description => '',
- ExecModule => 'ExtractSubjectTag',
- );
+($id, $message) = $action->Load('ExtractSubjectTag');
+if (!$id) {
+ ($id, $message) = $action->Create( Name => 'ExtractSubjectTag',
+ Description => '',
+ ExecModule => 'ExtractSubjectTag',
+ );
+}
ok ($id, "create action? " . $message);
-# add the scrip to the database
-
+# check if the scrip is installed, and if not add it to the database
my $scrip = RT::Scrip->new($RT::SystemUser);
-($id, $message)
- = $scrip->Create(
- Description => 'OnTransactionExtractSubjectTag',
- Queue => 0,
- ScripCondition => 'On Transaction',
- ScripAction => 'ExtractSubjectTag',
- Template => 'Blank',
- Stage => 'TransactionCreate',
- );
-#ok ($scrip->Description eq 'OnTransactionExtractSubjectTag', 'can create scrip');
+($id, $message) = $scrip->Load('OnTransactionExtractSubjectTag');
+if (!$id) {
+ ($id, $message)
+ = $scrip->Create(
+ Description => 'OnTransactionExtractSubjectTag',
+ Queue => 0,
+ ScripCondition => 'On Transaction',
+ ScripAction => 'ExtractSubjectTag',
+ Template => 'Blank',
+ Stage => 'TransactionCreate',
+ );
+}
ok ($id, "create scrip? " . $message);
### test default action (extract other RT instances' tags) ###
More information about the Rt-commit
mailing list