(#12392): Colorize console output on Windows

Previously, `Puppet[:color]` was false on Windows, because the Windows
console does not support ANSI escape sequences.

The win32console gem converts ANSI color escape sequences into Win32
console API calls to change the foreground color, etc. If the output
stream has been redirected to a file, then the gem does not translate
the sequences, instead preserving them in the stream, as is done on
Unix.

To disable colorized output specify `color=false` or `--color=false` on
the command line.

This commit adds a `Puppet.features.ansicolor?` feature that defines
whether ANSI color escape sequences are supported. On Windows, this is
only true if the win32console gem can be loaded. On other platforms, the
value is always true.

The win32console gem will be packaged into the Windows installer, and
so, `Puppet[:color]` now defaults to true. If the gem can't be loaded,
then puppet will revert to its previous behavior.
Merge remote-tracking branch 'joshcooper/ticket/2.7.x/13956-colorize-windows' into 2.7.x

* joshcooper/ticket/2.7.x/13956-colorize-windows:
  (#12392): Colorize console output on Windows
Just change Puppet settings in tests, rather than stubbing.

The stubbing in these tests blew up when an unexpected interaction happened;
it isn't clear why that was stubbed anyhow as we can just set settings
directly, to avoid exactly this failure mode.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #714 from daniel-pittman/maint/2.7.x/fix-busted-colour-tests

Maint/2.7.x/fix busted colour tests
(maint) Fix destinations_spec failure on windows

The CI spec tests for Puppet 2.7.x on windows are failing.  This is bad.

The reason they're failing is because we recently patched Puppet 2.7.x
to add a new feature, Puppet.features.ansicolor?  If this feature is
true then Puppet will output with ANSI colors.  If false, bare strings
are sent.

The existing destinations_spec test wasn't updated to reflect this new
feature.  The existing spec test assumes ANSI sequences will always be
sent if Puppet[:color] = true, but this is no longer the case because we
only send ANSI sequences if Puppet[:color] = true and
Puppet.features.ansicolor? is truthy.

This patch fixes the problem by stubbing Puppet.features.ansicolor? to
be true, matching up the spec expectation to the behavior of the system.
Just change Puppet settings in tests, rather than stubbing.

I'm following Daniel's lead from cde3bee0 on this one.

Stubbing Puppet.settings can cause bad side effects so let's just set
the setting and let the spec helper reset the settings system for us.
Merge remote-tracking branch 'jeffmccune/fix/2.7.x/specs_fail_without_win32console_gem' into 2.7.x

* jeffmccune/fix/2.7.x/specs_fail_without_win32console_gem:
  Just change Puppet settings in tests, rather than stubbing.
  (maint) Fix destinations_spec failure on windows

Signed-off-by: Jeff McCune <jeff@puppetlabs.com>
(#13956) Fix failing spec tests

The tests fail if the win32console gem isn't installed.  This patch fixes the
problem by stubbing out Puppet.features.ansicolor?
Merge branch 'fix/2.7.x/13956_fix_spec_tests_when_win32console_is_missing' into 2.7.x

* fix/2.7.x/13956_fix_spec_tests_when_win32console_is_missing:
  (#13956) Fix failing spec tests

Signed-off-by: Jeff McCune <jeff@puppetlabs.com>
(#13651) Use magenta, not purple in Facter::Util::Colors

This replaces all cases of the term 'purple' for the more standard 'magenta',
as per the naming used in most ANSI escape code charts.
Merge pull request #631 from kbarber/ticket/2.7.x/13651-magenta_not_purple

(#13651) Use magenta, not purple in Facter::Util::Colors
Merge 2.7.x into master.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>