formula: output recommended/optional deps in JSON.

Fixes Homebrew/homebrew#47914 by distinguishing between required, optional, and
recommended dependencies when using `brew info --json=v1`. This is done
by adding the `optional_dependencies` and `recommended_dependencies`
fields to the JSON output.

A good example of this fix is `brew info --json=v1 dtrx`.

Closes Homebrew/homebrew#48196.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
John Zeringue 2016-01-18 08:45:58 +00:00 committed by Mike McQuaid
parent b6729191fa
commit a600262f68

View File

@ -1244,6 +1244,8 @@ class Formula
"outdated" => outdated?,
"keg_only" => keg_only?,
"dependencies" => deps.map(&:name).uniq,
"recommended_dependencies" => deps.select(&:recommended?).map(&:name).uniq,
"optional_dependencies" => deps.select(&:optional?).map(&:name).uniq,
"conflicts_with" => conflicts.map(&:name),
"caveats" => caveats
}