Better ANSI handling and heuristics

This improves several things:

First, the heuristics whether the system supports ANSI codes or not will
only be run once.

Second, the heuristics now check whether stdout is a tty on non-Windows
machines. This ensures that when running the installer in a terminal,
colors will be used, but when running it in a script where stdout is
redirected to a log file or somewhere else, no colors will be used.

Third, the user can now override this auto-detection via two new command
line switches.

Passing --no-ansi to the installer will disable all heuristics to find
out whether or not stdout supports ANSI escape codes and simply not
output ANSI codes at all.

Passing --ansi, on the other hand, will always enable them.

See composer/getcomposer.org#54 for a discussion.

I also have another branch where only a --no-ansi switch exists (as
requested by @Seldaek), and one where only the two switches exist, but
the heuristics have not been improved.

This branch here is the deluxe version and the one I recommend for
inclusion into the Composer installer. The overall complexity of the
changes is not significantly higher than the "el cheapo" solution that
only has --no-ansi.
Merge pull request #54 from scy/ansi-awesome

Installer using colors when it shouldn't