(#11955) Refactor to use IO.binread
Previously, I had created a utility method Puppet::Util.binread,
since IO.binread was added in ruby 1.9. This commit monkey patches
the method, if it's not defined, to make the transition to ruby 1.9
seamless. And while I was at it, I add the corresponding IO.binwrite
method.
The motivation for these methods is that, in general, we should always
be using binary mode when performing file I/O. However, text mode is
the default on Windows, and using text mode can corrupt binary data,
e.g. executables. So use binary mode, unless you know what text mode
is and why you need to use it.
Conflicts:
spec/unit/file_serving/content_spec.rb