puppetlabs/puppet — pull request #392 by jeffmccune (2012-01-23 17:43:19+00:00)
Title: Ticket/2.7.x/11955 binread

commit f56a09addd08550b470f4818c24fbe32b9d50b50
Author: Josh Cooper
Date: Mon Jan 23 09:30:03 2012 -0800

(#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

commit 8202729ede076ad17b5bde1ec1fe134ace1657df
Author: Josh Cooper
Date: Fri Jan 20 21:54:44 2012 -0800

(#11955) Monkey patch IO.binread and IO.binwrite

binread and binwrite are only available in ruby 1.9, so adding these
for older ruby versions.