This logic is ugly as the installation directory will be left
in a mangled state if it fails partway through. However, the
same is true when `rmtree` fails partway through, which this
code is intended to minimize.
References: #5504
This is just a matter of semantics: renaming the abstract base
class `Cask::Container::UnarBase` so that it makes sense when
referring to it in a `container_type` stanza.
According to the logic of #5080, we should move away from calling
Homebrew internals, in part because things break over time, as
happened here with the implementation of `depends_on_formula`
(shortly to become `depends_on :formula`).
This re-implements formula dependencies by invoking the Homebrew
CLI, which is the only stable API Homebrew guarantees.
Fixes#5475Fixes#4010
Forgotten in #4688, but should be considered part of Cask DSL 1.0.
A `depends_on` stanza is much less useful without the corresponding
`conflicts_with`.
References: #4896
- remove font tags (per earlier discussion - they were left
in by mistake)
- add tag `:name` for corner cases where the Cask name cannot
adequately follow the product name. Examples: non-English
apps, App bundles which do not match publicized names.
This is possibly the cause of other glitches such as random
failures on Travis.
Ruby 1.8 popen3 does set global $? for the exit status, Ruby
1.9 and above does not. For Ruby 2.0 users (Mavericks and
above with recent Homebrew), success or failure of the current
external command was determined by the exit status of some
previous command.
Closescaskroom/homebrew-fonts#186
Currently, Casks names are constrained by the need to form
valid Ruby class names. This change enables a new syntax,
in which the first line of a Cask will read like
```ruby
cask :v1 => 'my-app' do
```
where :v1 refers to the version of the DSL spec.
- `:delete` is intended to replace `:files`
- `:trash` is intended to move files to the OS X Trash
- `:trash` is only a stub — currently all three function identically
References: #4688
The zap functionality here is in working form, but there is not a
corresponding `brew cask zap` command verb, which is to be supplied
in a separate PR.
Like other forward-compatible DSL extensions, it is intentionally
undocumented.
References: #4688
References: #4688.
For forward-compatibility; intentionally left undocumented.
The `license` stanza is not free-form. There is a limited
set of valid symbols, of which the argument must be a member.
(The set will later be documented, and probably needs amendments.)
Version numbers and variants of licenses are intentionally
ommitted. The use-case for `license` is filtering and listing
of Casks. We want to avoid becoming a detailed repository of
application descriptions: that information can be found at the
`homepage` URL.
- Raise `CaskError` instead of `Plist::ParseError` from module
- Improve error message when parse result is empty
- remove leading garbage text and emit it to stderr (seen in #5060)
- remove trailing garbage text and emit it to stderr (seen in #4819)
This has the incidental effect of emitting DMG licenses during
installation, which seems desirable as permanent functionality.
If not permanent, the warnings to STDERR should still be kept
temporarily to help get better bug reports on `hdiutil`.
A bug wrt DMG licenses must have been introduced in one of
#4892, #4887, #4889, #4900, #4975, #4978, or #4857. Presumably,
the cause is that STDERR was previously silenced when running
`hdiutil`. It would be cleaner (and more reliable) to redirect
STDERR and examine it separately, rather than clean up the
merged outputs.
closes#4819closes#5060
Covering all cases
- external commands as executables
- external commands as Ruby libraries
- built-in command verbs
This is intended as a development aid.
A side benefit is that an external command can be constructed
to use a `run` method, rather than having to accomplish everything
at `require` time.
- based on abstract class `Cask::CLI::InternalUseBase`
- interal-use class file names follow `internal_<verb>.rb`, but the "internal" is dropped for the CLI
- internal-use verbs start with underscore at CLI
- internal-use verbs are invisible in the usage document
For forward-compatibility, intentionally undocumented. Currently
works only as a synonym: `depends_on :formula` substitutes for
`depends_on_formula`, which is intended to be removed.
However, this PR also provides additional `depends_on` keys for
future expansion of functionality:
- `:cask`
- `:macos`
- `:arch`
- `:x11`
- `:java`
The symbol names were chosen to match those used in Homebrew Formulae.
References: #4688, #2001
As parameter to the `run` method, but also exposed as interface to Cask authors
in eg `uninstall` `:script`. The existing DSL design: `:stderr => :silence`
is more flexible/extensible.
References: #4688
nstead, determine success by directly testing the intended effect:
does the mount path still exist?
Also:
- retry once on failure.
- silent success if the given mount point did not exist.
These changes are intended to help with unpredictable problems with
the test suite that manifest frequently on Travis.
References: #4975, #4900, #4857
- separated from class `Cask::Artifact::Pkg` (the `:uninstall` DSL key)
- `:uninstall` can now be invoked for all Casks
- `uninstall_test.rb` also had to be separated from `pkg_test.rb`
Because backtick has a different meaning in the shell, and the user
may copy-and-paste such text.
Some light re-wording included as well, and a reference to "brew cask edit"
changed to "brew cask cat" for simplicity.
Mysterious `hdiutil` errors are a longtime problem with the
test suite, and the largest cause of false Travis failure
reports.
What appears to happen is that `hdiutil` returns a valid
plist output, but also exits with an error code.
Recently, user errors have been reported which seem to be
related to the same problem (#4857).
After #4892 and #4887, we have have more assurances that mount errors
will be caught elsewhere, if the XML is incorrect/missing, or if the
mounts are not returned.
So, for this special case, it should be safe to simply
ignore the error code from `hdiutil`.
This may not be strictly necessary. But it should help track
down the `hdiutil` errors, which are persistent, but occasional,
and hard to reproduce. (We pass a flag to `hdiutil` to make
respond in XML.)
The logic for better errors was already there; this just makes
sure that another exceptional case is handled, and falls through
to the existing error-check.
References: #4857
HOLD until #4865 is merged.
After #4865, `caskroom_only` can be subclassed from Cask::Artifact::Base
like any other artifact. It no longer has the special property of
making `uninstall` stanzas work.
This stanza has never been documented. It is possible that it will
no longer be needed, after #4865 and subsequent cleanup on Casks that
use this form.
References: #4688
This makes the following stanzas available in the DSL as
synonyms to existing stanza, with no change to existing
functionality:
- pkg for `install`
- app for `link`
- suite for `link`
- preflight for `before_install`
- postflight for `before_uninstall`
- uninstall_preflight for `before_uninstall`
- uninstall_postflight for `after_uninstall`
References #4688
This works, but is marked WIP because we are not in a hurry,
and because I intend to add tests.
Including the case where a Cask is already installed.
Always continue installing when multiple Casks are specified,
only raising an exception at the end of the command (if some
portion of the attempted install actions failed). Never
exit with an error code if "already installed" was the only
problem seen during the run.
Also tweak error messages.
Fixes#1347, #2677, #4785
Required disabling two tests regarding suggestions on Cask
spelling errors.
before invoking `each` method. This is necessitated by Homebrew's
switch to Ruby 2.0.
Also standardize how all `uninstall` directives are coerced to Array,
in a way that is compatible between Ruby 1.8 and 2.0.
Fixes#4784.
Fixes#4677. This change is necessitated by Homebrew's recent
switch to Ruby 2.x. These changes may be incomplete and/or
may not work well with Ruby 1.8. Travis should test Ruby 1.8
compatibility.