Options can be passed on the command-line and/or using
the HOMEBREW_CASK_OPTS environment variable (which has
lowest priority). There is a single --appdir=PATH option
right now, but this commit enables future awesomeness!
Other minor changes:
* `brew cask help` now returns the same thing as `brew cask`
instead of saying there was “no such command as help”.
* The HEREDOC block now uses Homebrew's #undent instead of the
customed-rolled #gsub version. Cleaner and more flexible.
* `Cask.set_appdir` has been renamed to `Cask.appdir=`. This
is more Rubyish, and of little consequence (the only place
it was previously used was in the tests).
should take care of #104
this was a subtle one - after i reorganized the requires, plist/parser
was getting double required, which broke plist parsing and hence dmg
installs
homebrew does internal caching in ARGV that prevents us from doing the
`ARGV.clear; ARGV << 'newarg'` trick twice.
rather than try to further reach in to homebrew's innards, i figure it's
better to just pass multiple arguments down to homebrew code at once,
since it already supports that
refs #47
this delegates to homebrew's uninstall to get its work done. vanilla
`brew uninstall` actually works, but this gives us a more consistent
interface.
as discussed in #47
should address #33
includes cleanup and tests
i'm not crazy about leaning on installing/uninstalling caffeine in the
tests. it makes for some unnecessarily heavy tests and downloads. but
i'd rather get tests in place first then fix the warts.
I chose Caffeine since it's relatively small to download. Eventually I'd
like to switch this up so we bundle a dmg, zip, etc that the test suite
wires in to verify that we do the Right Thing (tm) with all those file
types. Probably will want to support `file://` URLs in Casks to help us
for that use case.
Just getting started of course, but this piggy backs on Homebrew's
testing strategy to give us a platform for a fully featured test suite.
Neato!
And the tests provide value right away, as I added some better error
handling to `Cask.load`.
Big things ahead. Just you wait.
turns out a symlink of a directory is both a symlink and a directory, so
you have to test for symlink first if you want to catch it.
this should address #36
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`.