aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJohn Zeringue2016-01-18 08:45:58 +0000
committerMike McQuaid2016-01-18 08:45:58 +0000
commita600262f681f610b01b1343b80cd8162834a3b45 (patch)
treea358ecf381c6fa0002cf3b314048a324778c4b20 /Library
parentb6729191fa62f3ebed6aba8935255f2a4f9b42a0 (diff)
downloadbrew-a600262f681f610b01b1343b80cd8162834a3b45.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 884385996..3d8e26f44 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -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
}