Skip to content

Commit

Permalink
Merge pull request #12552 from Bo98/hash-keg_only_reason
Browse files Browse the repository at this point in the history
formula: add keg_only_reason to formula hash
  • Loading branch information
MikeMcQuaid authored Dec 14, 2021
2 parents b0c294d + 00b5880 commit 2eaa34e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,7 @@ def to_hash
"version_scheme" => version_scheme,
"bottle" => {},
"keg_only" => keg_only?,
"keg_only_reason" => keg_only_reason&.to_hash,
"bottle_disabled" => bottle_disabled?,
"options" => [],
"build_dependencies" => dependencies.select(&:build?)
Expand Down
13 changes: 13 additions & 0 deletions Library/Homebrew/formula_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ def to_s
@reason
end.strip
end

def to_hash
reason_string = if @reason.is_a?(Symbol)
@reason.inspect
else
@reason.to_s
end

{
"reason" => reason_string,
"explanation" => @explanation,
}
end
end

# Used to annotate formulae that don't require compiling or cannot build a bottle.
Expand Down

0 comments on commit 2eaa34e

Please sign in to comment.