missing: exit nonzero if missing deps are found

This commit is contained in:
Steven Peters 2018-04-12 22:35:51 -07:00
parent 50059990e2
commit 2adfb77cd8
4 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,8 @@
#: #:
#: If `--hide=`<hidden> is passed, act as if none of <hidden> are installed. #: If `--hide=`<hidden> is passed, act as if none of <hidden> are installed.
#: <hidden> should be a comma-separated list of formulae. #: <hidden> should be a comma-separated list of formulae.
#:
#: `missing` exits with a non-zero status if any formulae are missing dependencies.
require "formula" require "formula"
require "tab" require "tab"
@ -25,6 +27,7 @@ module Homebrew
missing = f.missing_dependencies(hide: ARGV.values("hide")) missing = f.missing_dependencies(hide: ARGV.values("hide"))
next if missing.empty? next if missing.empty?
Homebrew.failed = true
print "#{f}: " if ff.size > 1 print "#{f}: " if ff.size > 1
puts missing.join(" ") puts missing.join(" ")
end end

View File

@ -14,7 +14,7 @@ describe "brew missing", :integration_test do
expect { brew "missing" } expect { brew "missing" }
.to output("foo\n").to_stdout .to output("foo\n").to_stdout
.and not_to_output.to_stderr .and not_to_output.to_stderr
.and be_a_success .and be_a_failure
end end
it "prints nothing if all dependencies are installed" do it "prints nothing if all dependencies are installed" do
@ -35,7 +35,7 @@ describe "brew missing", :integration_test do
expect { brew "missing", "--hide=foo" } expect { brew "missing", "--hide=foo" }
.to output("bar: foo\n").to_stdout .to output("bar: foo\n").to_stdout
.and not_to_output.to_stderr .and not_to_output.to_stderr
.and be_a_success .and be_a_failure
end end
end end
end end

View File

@ -340,6 +340,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--hide=``hidden` is passed, act as if none of `hidden` are installed. If `--hide=``hidden` is passed, act as if none of `hidden` are installed.
`hidden` should be a comma-separated list of formulae. `hidden` should be a comma-separated list of formulae.
`missing` exits with a non-zero status if any formulae are missing dependencies.
* `options` [`--compact`] (`--all`|`--installed`|`formulae`): * `options` [`--compact`] (`--all`|`--installed`|`formulae`):
Display install options specific to `formulae`. Display install options specific to `formulae`.

View File

@ -346,6 +346,9 @@ Check the given \fIformulae\fR for missing dependencies\. If no \fIformulae\fR a
.IP .IP
If \fB\-\-hide=\fR\fIhidden\fR is passed, act as if none of \fIhidden\fR are installed\. \fIhidden\fR should be a comma\-separated list of formulae\. If \fB\-\-hide=\fR\fIhidden\fR is passed, act as if none of \fIhidden\fR are installed\. \fIhidden\fR should be a comma\-separated list of formulae\.
. .
.IP
\fBmissing\fR exits with a non\-zero status if any formulae are missing dependencies\.
.
.TP .TP
\fBoptions\fR [\fB\-\-compact\fR] (\fB\-\-all\fR|\fB\-\-installed\fR|\fIformulae\fR) \fBoptions\fR [\fB\-\-compact\fR] (\fB\-\-all\fR|\fB\-\-installed\fR|\fIformulae\fR)
Display install options specific to \fIformulae\fR\. Display install options specific to \fIformulae\fR\.