[Bps-public-commit] rt-extension-articletemplates branch, rt5-updates, created. 1.02-2-gd5273e8
Craig Kaiser
craig at bestpractical.com
Thu Jun 17 08:58:00 EDT 2021
The branch, rt5-updates has been created
at d5273e8dd9bce5aae5598e8e9538a81bf3127514 (commit)
- Log -----------------------------------------------------------------
commit 4684a237913df6f691b1a9e5567d5fd9f9a24e05
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Jun 16 16:51:22 2021 -0400
Update Module::Install
diff --git a/META.yml b/META.yml
index 671e45f..47070eb 100644
--- a/META.yml
+++ b/META.yml
@@ -28,5 +28,5 @@ resources:
license: http://opensource.org/licenses/gpl-license.php
repository: https://github.com/bestpractical/rt-extension-articletemplates
version: '1.02'
-x_module_install_rtx_version: '0.40'
+x_module_install_rtx_version: '0.42'
x_requires_rt: 4.0.0
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 d5273e8dd9bce5aae5598e8e9538a81bf3127514
Author: craig kaiser <craig at bestpractical.com>
Date: Thu Jun 17 08:52:51 2021 -0400
Update for RT 5
diff --git a/META.yml b/META.yml
index 47070eb..b926842 100644
--- a/META.yml
+++ b/META.yml
@@ -30,3 +30,4 @@ resources:
version: '1.02'
x_module_install_rtx_version: '0.42'
x_requires_rt: 4.0.0
+x_rt_too_new: 5.2.0
diff --git a/Makefile.PL b/Makefile.PL
index 752c2a6..472eec6 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,10 +1,12 @@
+use lib '.';
use inc::Module::Install;
RTx 'RT-Extension-ArticleTemplates';
repository('https://github.com/bestpractical/rt-extension-articletemplates');
-requires_rt('4.0.0');
+requires_rt '4.0.0';
+rt_too_new '5.2.0';
build_requires 'Test::More';
diff --git a/README b/README
index 044e910..3f6cafc 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ NAME
RT::Extension::ArticleTemplates - Turns Articles into dynamic templates
RT VERSION
- Works with RT 4.0, 4.2 and 4.4.
+ Works with RT 4.4 and 5.0.
DESCRIPTION
When this extension is installed, RT parses the content of Articles as a
@@ -24,7 +24,7 @@ INSTALLATION
make install
May need root permissions
- Edit your /opt/rt4/etc/RT_SiteConfig.pm
+ Edit your /opt/rt5/etc/RT_SiteConfig.pm
If you are using RT 4.2 or greater, add this line:
Plugin('RT::Extension::ArticleTemplates');
@@ -36,8 +36,14 @@ INSTALLATION
or add RT::Extension::ArticleTemplates to your existing @Plugins
line.
+ Patch RT
+ This step is required only for RT versions 5.0.0 and 5.0.1. Apply
+ the patch as follows:
+
+ patch -p1 -d /path/to/rt < patches/article-preformatted-ticket-object.patch
+
Clear your mason cache
- rm -rf /opt/rt4/var/mason_data/obj
+ rm -rf /opt/rt5/var/mason_data/obj
Restart your webserver
diff --git a/lib/RT/Extension/ArticleTemplates.pm b/lib/RT/Extension/ArticleTemplates.pm
index e768c0c..4f38eb2 100644
--- a/lib/RT/Extension/ArticleTemplates.pm
+++ b/lib/RT/Extension/ArticleTemplates.pm
@@ -11,7 +11,7 @@ RT::Extension::ArticleTemplates - Turns Articles into dynamic templates
=head1 RT VERSION
-Works with RT 4.0, 4.2 and 4.4.
+Works with RT 4.4 and 5.0.
=head1 DESCRIPTION
@@ -41,7 +41,7 @@ is installed -- even if it is not a valid template.
May need root permissions
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
If you are using RT 4.2 or greater, add this line:
@@ -53,9 +53,16 @@ For RT 4.0, add this line:
or add C<RT::Extension::ArticleTemplates> to your existing C<@Plugins> line.
+=item Patch RT
+
+This step is required B<only> for RT versions 5.0.0 and 5.0.1. Apply
+the patch as follows:
+
+ patch -p1 -d /path/to/rt < patches/article-preformatted-ticket-object.patch
+
=item Clear your mason cache
- rm -rf /opt/rt4/var/mason_data/obj
+ rm -rf /opt/rt5/var/mason_data/obj
=item Restart your webserver
diff --git a/patches/article-preformatted-ticket-object.patch b/patches/article-preformatted-ticket-object.patch
new file mode 100644
index 0000000..d958794
--- /dev/null
+++ b/patches/article-preformatted-ticket-object.patch
@@ -0,0 +1,26 @@
+commit 01b601a53c68b9d46f722124f154a28bee9e4ce1
+Author: Jim Brandt <jbrandt at bestpractical.com>
+Date: Thu Nov 12 08:40:46 2020 -0500
+
+ Restore Ticket object to arguments passed to Preformatted
+
+ f2124f372 removed the ticket object passed as an argument to
+ Preformatted because it was no longer needed in RT. However,
+ RT::Extension::ArticleTemplates still needs the ticket object,
+ so restore it to that call.
+
+diff --git a/share/html/Articles/Elements/IncludeArticle b/share/html/Articles/Elements/IncludeArticle
+index a64684c86..ce75ffb21 100644
+--- a/share/html/Articles/Elements/IncludeArticle
++++ b/share/html/Articles/Elements/IncludeArticle
+@@ -78,8 +78,9 @@ if ( $ret && $article->Id ){
+ return;
+ }
+
++ # $Ticket below is used by RT::Extension::ArticleTemplates
+ my $formatted_article = $m->scomp('/Articles/Article/Elements/Preformatted',
+- Article => $article
++ Article => $article, Ticket => $Ticket
+ );
+
+ $m->callback( Article => $article, Ticket => $Ticket, formatted_article => \$formatted_article, ARGSRef => \%ARGS );
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list