Some zip files have a different definition, e.g.
Minecraft has:
application/xml; charset=utf-8 compressed-encoding=application/zip;
charset=binary; charset=binary
Most other zips have:
application/x-empty; compressed-encoding=application/zip;
charset=binary; charset=binary
But the result is the same. So now we test only for:
compressed-encoding=application/zip; charset=binary; charset=binary
Most notably, Cask.all returns an array of strings,
not of Cask instances. This makes things easier, as
well as faster, as there's no need to run map(&:to_s)
everywhere anymore.
self.path is a utility method which returns the path
of the cask from its title. There's something subtle
going in there:
- If `cask_title` is fully qualified, e.g.
"phinze-cask/alfred", it's straightforward.
- If `cask_title` is only the name, e.g.
"firefox-aurora", the name is matched from
the full list (self.all) (which isn't sorted)
and the first result is returned.
Hence, self.path with only the name is not precise.
There might be the possibility to apply heuristics
to do a better match (prefer phinze-cask, or maybe
installed casks?) but that's for another issue :-)
self.nice_listing is another utility method used
in `search` and `list`. It returns a list where
unique casks don't have a prefix, and duplicates
do. The prefix is the tap name. The list is then
sorted. For an example or two, look at the first
comment on phinze/#12.
Instead of only listing `Taps/phinze-cask/Casks`, now list
every taps that has a `Casks` directory. Might conflict with
a few commands for the moment, works OK with `brew cask search`.
There was an inconsistency between the cask filename
and the class name which caused an exception to be
thrown when running `brew cask search` (and possibly
other commands).