[Bps-public-commit] Module-Install-RTx branch, rt-too-new-warn, created. 0.41-2-ge89a016
Jim Brandt
jbrandt at bestpractical.com
Wed Jul 15 10:22:59 EDT 2020
The branch, rt-too-new-warn has been created
at e89a016d0845bc4d235052cfc33412734b8f2abd (commit)
- Log -----------------------------------------------------------------
commit 6860d26b3a59482eb5de055555d2fdce67b7a3f5
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Jul 9 03:46:28 2020 +0800
Make rt_too_new warn instead to not block installation
E.g.
rt_too_new('5.2.0');
This usually doesn't mean the extension won't work with RT 5.2(since
it's not released yet, we actually don't know if it will work or not for
now). It's quite possible that current extension works fine with RT 5.2
without any changes.
Thus here we choose to warn that it's not tested yet.
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 3e906c3..5cafe01 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -263,8 +263,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;
@@ -273,7 +273,7 @@ EOT
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[0] eq $version) {
- die sprintf($msg,$RT::VERSION,$version);
+ warn sprintf($msg,$RT::VERSION);
}
}
commit e89a016d0845bc4d235052cfc33412734b8f2abd
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Jul 15 10:20:19 2020 -0400
Add red color to warnings to make them stand out
Module::Install prints a bunch of information to the terminal
when you run Makefile.PL and that can make it easy for
installers to miss warning messages that they should read. Add
text color to make messages stand out.
The \n is moved to the end of the warn lines to suppress printing
the "at linenumber" messages in output.
diff --git a/lib/Module/Install/RTx.pm b/lib/Module/Install/RTx.pm
index 5cafe01..d423b02 100644
--- a/lib/Module/Install/RTx.pm
+++ b/lib/Module/Install/RTx.pm
@@ -5,6 +5,7 @@ use strict;
use warnings;
no warnings 'once';
+use Term::ANSIColor qw(:constants);
use Module::Install::Base;
use base 'Module::Install::Base';
our $VERSION = '0.41';
@@ -248,12 +249,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(@_);
}
@@ -265,7 +266,6 @@ sub rt_too_new {
**** 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;
@@ -273,7 +273,7 @@ EOT
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[0] eq $version) {
- warn sprintf($msg,$RT::VERSION);
+ warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
}
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list