formula: reorder to_hash.
Let's reorder this to more closely match the ordering in a formula file. This makes `to_hash` (and our JSON output) more useful and easily readable for people used to formula files.
This commit is contained in:
parent
4ebccf79a8
commit
0797a3e19e
@ -1548,44 +1548,34 @@ class Formula
|
||||
hsh = {
|
||||
"name" => name,
|
||||
"full_name" => full_name,
|
||||
"desc" => desc,
|
||||
"homepage" => homepage,
|
||||
"oldname" => oldname,
|
||||
"aliases" => aliases.sort,
|
||||
"desc" => desc,
|
||||
"homepage" => homepage,
|
||||
"versions" => {
|
||||
"stable" => stable&.version&.to_s,
|
||||
"bottle" => !bottle_specification.checksums.empty?,
|
||||
"devel" => devel&.version&.to_s,
|
||||
"head" => head&.version&.to_s,
|
||||
"bottle" => !bottle_specification.checksums.empty?,
|
||||
},
|
||||
"revision" => revision,
|
||||
"version_scheme" => version_scheme,
|
||||
"bottle" => {},
|
||||
"keg_only" => keg_only?,
|
||||
"options" => [],
|
||||
"build_dependencies" => dependencies.select(&:build?).map(&:name).uniq,
|
||||
"dependencies" => dependencies.map(&:name).uniq,
|
||||
"recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq,
|
||||
"optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq,
|
||||
"requirements" => [],
|
||||
"conflicts_with" => conflicts.map(&:name),
|
||||
"caveats" => caveats,
|
||||
"installed" => [],
|
||||
"linked_keg" => linked_version&.to_s,
|
||||
"pinned" => pinned?,
|
||||
"outdated" => outdated?,
|
||||
"keg_only" => keg_only?,
|
||||
"dependencies" => dependencies.map(&:name).uniq,
|
||||
"recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq,
|
||||
"optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq,
|
||||
"build_dependencies" => dependencies.select(&:build?).map(&:name).uniq,
|
||||
"conflicts_with" => conflicts.map(&:name),
|
||||
"caveats" => caveats,
|
||||
}
|
||||
|
||||
hsh["requirements"] = requirements.map do |req|
|
||||
{
|
||||
"name" => req.name,
|
||||
"cask" => req.cask,
|
||||
"download" => req.download,
|
||||
}
|
||||
end
|
||||
|
||||
hsh["options"] = options.map do |opt|
|
||||
{ "option" => opt.flag, "description" => opt.description }
|
||||
end
|
||||
|
||||
hsh["bottle"] = {}
|
||||
%w[stable devel].each do |spec_sym|
|
||||
next unless spec = send(spec_sym)
|
||||
next unless spec.bottle_defined?
|
||||
@ -1607,6 +1597,18 @@ class Formula
|
||||
hsh["bottle"][spec_sym] = bottle_info
|
||||
end
|
||||
|
||||
hsh["options"] = options.map do |opt|
|
||||
{ "option" => opt.flag, "description" => opt.description }
|
||||
end
|
||||
|
||||
hsh["requirements"] = requirements.map do |req|
|
||||
{
|
||||
"name" => req.name,
|
||||
"cask" => req.cask,
|
||||
"download" => req.download,
|
||||
}
|
||||
end
|
||||
|
||||
installed_kegs.each do |keg|
|
||||
tab = Tab.for_keg keg
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user