[Bps-public-commit] rt-extension-notifyslack branch, master, updated. f589c90f9f002387f32914ff58de37fa36587617

Jim Brandt jbrandt at bestpractical.com
Thu Sep 3 15:39:02 EDT 2020


The branch, master has been updated
       via  f589c90f9f002387f32914ff58de37fa36587617 (commit)
       via  109a518a7930f6b283604e08cb5a2ce137d59e48 (commit)
      from  6fdd1ba7a9608a7c931e0977dea25f8a85087d55 (commit)

Summary of changes:
 Changes                         |  5 ++++-
 META.yml                        |  6 +++---
 Makefile.PL                     |  1 +
 README                          | 16 +++++++++-------
 inc/Module/Install/RTx.pm       | 36 ++++++++++++++++++++++++++----------
 lib/RT/Extension/NotifySlack.pm |  2 +-
 6 files changed, 44 insertions(+), 22 deletions(-)

- Log -----------------------------------------------------------------
commit 109a518a7930f6b283604e08cb5a2ce137d59e48
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Sep 3 09:01:00 2020 -0400

    Prep first version

diff --git a/Changes b/Changes
index 31f45df..8ae8364 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
 Revision history for RT-Extension-NotifySlack
 
-0.01 [Release Date]
+0.01 2020-07-22
  - Initial version
diff --git a/META.yml b/META.yml
index fe2e8a5..e9ca32f 100644
--- a/META.yml
+++ b/META.yml
@@ -24,6 +24,6 @@ resources:
   license: http://opensource.org/licenses/gpl-license.php
   repository: https://github.com/bestpractical/rt-extension-notifyslack
 version: '0.01'
-x_module_install_rtx_version: '0.40'
+x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.4.0
 x_rt_too_new: 4.6.0
diff --git a/Makefile.PL b/Makefile.PL
index b47bc01..deb75d3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,3 +1,4 @@
+use lib '.';
 use inc::Module::Install;
 
 RTx     'RT-Extension-NotifySlack';
diff --git a/README b/README
index f6de98c..332cdf1 100644
--- a/README
+++ b/README
@@ -2,9 +2,10 @@ NAME
     RT-Extension-NotifySlack - RT ScripAction Slack integration
 
 DESCRIPTION
-    This extension provides the following Slack functionality with RT:
-
-    * post ticket updates to desired Slack channels
+    This extension allows for Slack updates to be sent out in the same
+    manner that emails are dispatched. Meaning that a on any condition a
+    Slack action can be called and a Slack specififc template can be used to
+    update a Slack channel.
 
 RT VERSION
     Works with RT 4.4
@@ -36,8 +37,8 @@ INSTALLATION
 CONFIGURATION
     You must add the desired Slack channels and webhook URLs to the RT
     %SlackWebHookUrls config value in RT_SiteConfig.pm. These values can be
-    retrieved from Slack's API Incoming Webhooks configuration settings. See
-    example below:
+    retrieved from the Slack API's Incoming Webhooks configuration settings.
+    See example below:
 
         Set( %SlackWebHookUrls,
             '#channel' => 'https://myslackwebhookurl...',
@@ -47,8 +48,9 @@ CONFIGURATION
     Slack channel is currently set to #general. You can update this in the
     initialdata file by changing the 'Notify Slack' ScripAction Argument to
     the desired Slack channel ( be sure to include the '#' when indicating
-    the channel name ). To post to additional Slack channels, copy the
-    ScripAction giving it a new Name and Argument.
+    the channel name and no '#' for direct messaging ). To post to
+    additional Slack channels, copy the ScripAction giving it a new Name and
+    Argument, something like "Slack Updates To #Support".
 
 AUTHOR
     Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 7cad529..2dd9489 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -6,9 +6,10 @@ use strict;
 use warnings;
 no warnings 'once';
 
+use Term::ANSIColor qw(:constants);
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.40';
+our $VERSION = '0.42';
 
 use FindBin;
 use File::Glob     ();
@@ -53,7 +54,7 @@ sub RTx {
         my @look = @INC;
         unshift @look, grep {defined and -d $_} @try;
         push @look, grep {defined and -d $_}
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+            map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
         last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
 
         warn
@@ -76,6 +77,22 @@ sub RTx {
         $self->requires_rt('4.0.0');
     }
 
+    my $package = $name;
+    $package =~ s/-/::/g;
+    if ( $RT::CORED_PLUGINS{$package} ) {
+        my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
+        die RED, <<"EOT";
+
+**** Error: Your installed version of RT ($RT::VERSION) already
+            contains this extension in core, so you don't need to
+            install it.
+
+            Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
+            to configure it.
+
+EOT
+    }
+
     # Installation locations
     my %path;
     my $plugin_path;
@@ -223,7 +240,7 @@ sub requires_rt {
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
-        die <<"EOT";
+        die RED, <<"EOT";
 
 **** Error: This extension requires RT $version. Your installed version
             of RT ($RT::VERSION) is too old.
@@ -249,12 +266,12 @@ sub requires_rt_plugin {
         unshift @INC, $path;
     } else {
         my $name = $self->name;
-        warn <<"EOT";
+        my $msg = <<"EOT";
 
 **** Warning: $name requires that the $plugin plugin be installed and
               enabled; it does not appear to be installed.
-
 EOT
+        warn RED, $msg, RESET, "\n";
     }
     $self->requires(@_);
 }
@@ -264,9 +281,8 @@ sub rt_too_new {
     my $name = $self->name;
     $msg ||= <<EOT;
 
-**** Error: Your installed version of RT (%s) is too new; this extension
-            only works with versions older than %s.
-
+**** Warning: Your installed version of RT (%s) is too new; this extension
+              has not been tested on your version of RT and may not work as expected.
 EOT
     $self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
 
@@ -274,7 +290,7 @@ EOT
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[0] eq $version) {
-        die sprintf($msg,$RT::VERSION,$version);
+        warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
     }
 }
 
@@ -297,4 +313,4 @@ sub _load_rt_handle {
 
 __END__
 
-#line 468
+#line 484

commit f589c90f9f002387f32914ff58de37fa36587617
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Sep 3 15:38:51 2020 -0400

    Prep for 0.02 release

diff --git a/Changes b/Changes
index 8ae8364..db7cb0e 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,7 @@
 Revision history for RT-Extension-NotifySlack
 
+0.02 2020-09-03
+ - Update sample template to correctly handle ticket values like Subject
+
 0.01 2020-07-22
  - Initial version
diff --git a/META.yml b/META.yml
index e9ca32f..b66dd62 100644
--- a/META.yml
+++ b/META.yml
@@ -23,7 +23,7 @@ requires:
 resources:
   license: http://opensource.org/licenses/gpl-license.php
   repository: https://github.com/bestpractical/rt-extension-notifyslack
-version: '0.01'
+version: '0.02'
 x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.4.0
-x_rt_too_new: 4.6.0
+x_rt_too_new: 5.2.0
diff --git a/lib/RT/Extension/NotifySlack.pm b/lib/RT/Extension/NotifySlack.pm
index 805b464..878ade8 100644
--- a/lib/RT/Extension/NotifySlack.pm
+++ b/lib/RT/Extension/NotifySlack.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 package RT::Extension::NotifySlack;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use RT::Transaction;
 

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


More information about the Bps-public-commit mailing list