swipely/docker-api — pull request #19 by kmullin (2013-07-11 22:57:14+00:00)
Title: Fix the file open mode for the tar file from text mode to binary mode

I encountered this error today on my system.

Was trying to pass a local directory to `build_from_dir`, and I traced it to the way that the tempfile is opened in text mode as opposed to binary.

[Ruby Docs](http://www.ruby-doc.org/core-2.0/IO.html#method-c-new)

```
1.9.3p429 :032 > f1 = File.open("/tmp/f1","w")
=> #
1.9.3p429 :033 > f2 = File.open("/tmp/f2","wb")
=> #
1.9.3p429 :034 > f1.external_encoding
=> #
1.9.3p429 :035 > f2.external_encoding
=> #
1.9.3p429 :041 > Archive::Tar::Minitar.pack('.', f1)
Encoding::UndefinedConversionError: "\xDF" from ASCII-8BIT to UTF-8
1.9.3p429 :042 > Archive::Tar::Minitar.pack('.', f2)
=> nil
```