phinze/homebrew-cask — pull request #2744 by rolandwalker (2014-02-03 16:56:53+00:00)
Title: Add 7z container support

relevant Casks must use `depends_on_formula unar`

Tests are handled similarly to the (updated) PR #1992 -- they will be skipped unless the developer has `unar` installed.

The system `/usr/bin/file` cannot recognize `7z` files, so `extension` and `magic_number` methods were added to `criteria.rb` to aid in determining filetypes.

Unlike #1992, this is implemented in terms of an abstract base class `Cask::Container::UnarBase`. We can use the base class to support Stuffit containers and whatever else is desired from the broad number of filetypes supported by `unar`. (I plan only 7z, Stuffit, and RAR).

Since `unar` provides a consistent interface across many archive types, it would actually be possible to skip having a `Cask::Container::SevenZip` class entirely in favor of a `Cask::Container::Unarable` which would come last in the list of container classes and function as a kind of catch-all. However, for both technical and stylistic reasons, I think being explicit is a better approach.