Rex

 view release on metacpan or  search on metacpan

lib/Rex.pm  view on Meta::CPAN

      }

      if ( $add eq "verbose_run" ) {
        Rex::Logger::debug("Enabling verbose_run feature");
        Rex::Config->set_verbose_run(1);
        $found_feature = 1;
      }

      if ( $add eq "disable_taskname_warning" ) {
        Rex::Logger::debug("Enabling disable_taskname_warning feature");
        Rex::Config->set_disable_taskname_warning(1);
        $found_feature = 1;
      }

      if ( $add eq "no_task_chaining_cmdline_args" ) {
        Rex::Logger::debug("Disabling task_chaining_cmdline_args feature");
        Rex::Config->set_task_chaining_cmdline_args(0);
        $found_feature = 1;
      }

      if ( $add eq "task_chaining_cmdline_args" ) {
        Rex::Logger::debug("Enabling task_chaining_cmdline_args feature");
        Rex::Config->set_task_chaining_cmdline_args(1);
        $found_feature = 1;
      }

      if ( $add eq "write_utf8_files" ) {
        Rex::Logger::debug("Enabling write_utf8_files feature");
        Rex::Config->set_write_utf8_files(1);
        $found_feature = 1;
      }

      if ( $add eq "no_write_utf8_files" ) {
        Rex::Logger::debug("Disabling write_utf8_files feature");
        Rex::Config->set_write_utf8_files(0);
        $found_feature = 1;
      }

      if ( $found_feature == 0 ) {
        Rex::Logger::info(
          "You tried to load a feature ($add) that doesn't exists in your Rex version. Please update.",
          "warn"
        );
        exit 1;
      }

    }

  }

  if ( exists $ENV{REX_REPORT_TYPE} ) {
    Rex::Logger::debug("Enabling reporting");
    Rex::Config->set_do_reporting(1);
  }

  if ( exists $ENV{REX_SUDO} && $ENV{REX_SUDO} ) {
    Rex::global_sudo(1);
  }

  # we are always strict
  strict->import;
}

=head1 FEATURE FLAGS

Everyone knows the pain if something gets deprecated and one has to
port his old (and stable) code to a new version of a library or a
framework. There is enough work to do instead of fixing code to work
with newer versions of them.

So there is one promise new versions of Rex has to fulfill. They must
be backward compatible.

I know this might be impossible in one way or another, but to minimize
this danger there is a thing called feature flags. If there is the need
to break backward compatibility in favor of a new feature there will be
a feature flag for this change. And only if this feature flag gets
enabled in the Rexfile it will break compatibility.

So the default is always to remain compatible.

If you have a problem that occurs after an update, it is considered as
a bug. Please report this bug in our issue tracker.

Also see the L<backwards compatibility|https://metacpan.org/release/Rex/source/CONTRIBUTING.md#backwardscompatibility>
section of the CONTRIBUTING guide.

=head2 How to enable feature flags

You can enable feature flags in your Rexfile with the following code:

    use Rex -feature => ['1.4'];

or even multiple ones like this:

    use Rex -feature => [qw(1.4 exec_autodie)];

=head2 List of feature flags

=over 4

=item 1.4

Enable per-task argument parsing (L<task_chaining_cmdline_args|Rex#task_chaining_cmdline_args>). Furthermore, all features from earlier versions are activated. Available since version 1.4.

=item no_task_chaining_cmdline_args

Disable per-task argument parsing. Available since version 1.4.

=item task_chaining_cmdline_args

Enable per-task argument parsing: C<rex --rex --args task1 --task1arg=value task2 --task2arg>
so task1 only gets C<task1arg> and task2 only gets C<task2arg>. Available since version 1.4.

=item 1.3

Activating the new template engine by default. Furthermore, all features from earlier versions are activated. Available since version 1.3.

=item no_template_ng

Disabling the new template engine. Available since version 1.3.



( run in 5.023 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )