swipely/docker-api — pull request #220 by tduffield (2014-11-26 19:06:32+00:00)
Title: Add support for Remove API v1.15

This is a rather fantastically large commit because there are a lot of things that I've added. Most of them were for my own sanity but I think they will be good code practices anyways.

I've tried to extensively document what I've done in each commit message but I'll add a high-level overview of what I've done here. If you have any questions or would like to tweak anything, please let me know.

Okay, I'm going to take you on the journey in chronological order. My first order of business was to get the Rspec tests to the point where they could work on my (and theoretically any) machine. This is some of the work that _may_ need to get tweaked since I couldn't test this elsewhere. Here is an outline of some of the work I did:
* Use VCR functionality to filter sensitive credentials from VCR cassettes
* Replace #attach with #streaming_logs for some helper code
* Stub ENV variable calls instead of overwriting
* Add the ability to cleanup the artifacts that Rspec tests leave behind on the Docker daemon
* Update some Rspec tests so they will pass against the 1.15 API
* Add Rake tasks and TESTING.md document to make testing more easily understandable.

Like I said, this was the bulk of the work. The end result however is that I think running rspec tests and re-recording VCR cassettes will be a lot simpler regardless of what machine you are running on.

Next, I added support for `docker exec` functionality. There is a lot going on in this commit but the summary is that the gem will now support runing exec instances inside containers. The Exec API appears to be a totally separate API from Containers to I created its own class. However, I did add an #exec method to Docker::Container to allow people to easily create exec instances from Container objects.

In fact, that is how I recommend people use the Docker::Exec functionality and thus why it is the only method documented at the moment. The Exec API is very young and functionality for Exec instances does not mirror that of Containers.

As part of adding Docker::Exec, I moved the #attach_for, #hijack_for, #attach_for_tty, #attach_for_multiplex and #debug methods from Docker::Container to Docker::Util so that I could share that library code between Docker::Container and Docker::Exec.