Skip to content

Commit

Permalink
lib/Rex/CLI.pm: display a warning when/if Rex::Template is loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurp committed Oct 14, 2021
1 parent fa11474 commit da8538c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions lib/Rex/CLI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ use Rex::TaskList;
use Rex::Logger;
use YAML;

use Data::Dumper;

my $no_color = 0;
eval "use Term::ANSIColor";
if ($@) { $no_color = 1; }
Expand Down Expand Up @@ -197,6 +195,7 @@ FORCE_SERVER: {

load_server_ini_file($::rexfile);
load_rexfile($::rexfile);
check_template_modules();

#### check if some parameters should be overwritten from the command line
CHECK_OVERWRITE: {
Expand Down Expand Up @@ -455,6 +454,30 @@ sub __help__ {

}

# Check whether Rex/Template.pm
# or Rex/Template/NG.pm modules are loaded. If there are,
# they should be present in the %INC hash.
sub check_template_modules {
my @tpl_modules_loaded =
grep { /(Rex\/Template|Rex\/Template\/NG)/ } keys %INC;
if ( scalar @tpl_modules_loaded > 0 ) {
Rex::Logger::info(
"WARNING! You are using Rex built-in template engine aka Rex::Template.",
"warn"
);
Rex::Logger::info(
"This engine is obsolete, unmaintained and will be retired in future releases.",
"warn"
);
Rex::Logger::info(
"Please consider migrating to a more modern template engine.", "warn" );
Rex::Logger::info(
"Text::Template::Simple, Template::Toolkit, etc. As usual, CPAN is you friend.",
"warn"
);
}
}

sub add_help {
my ( $self, $code ) = @_;
push( @help, $code );
Expand Down

0 comments on commit da8538c

Please sign in to comment.