Merge pull request #15402 from Bo98/tab-version-type-fix

tab: fix typing of versions
This commit is contained in:
Mike McQuaid 2023-05-11 13:08:25 +01:00 committed by GitHub
commit 082017e93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -1233,7 +1233,7 @@ on_request: installed_on_request?, options: options)
tab.time = Time.now.to_i
tab.aliases = formula.aliases
tab.arch = Hardware::CPU.arch
tab.source["versions"]["stable"] = formula.stable.version.to_s
tab.source["versions"]["stable"] = formula.stable.version&.to_s
tab.source["versions"]["version_scheme"] = formula.version_scheme
tab.source["path"] = formula.specified_path.to_s
tab.source["tap_git_head"] = formula.tap&.installed? ? formula.tap&.git_head : nil

View File

@ -45,8 +45,8 @@ class Tab
"tap_git_head" => nil, # Filled in later if possible
"spec" => formula.active_spec_sym.to_s,
"versions" => {
"stable" => formula.stable&.version.to_s,
"head" => formula.head&.version.to_s,
"stable" => formula.stable&.version&.to_s,
"head" => formula.head&.version&.to_s,
"version_scheme" => formula.version_scheme,
},
},
@ -108,6 +108,11 @@ class Tab
}
end
# Tabs created with Homebrew 1.5.13 through 4.0.17 inclusive created empty string versions in some cases.
["stable", "head"].each do |spec|
attributes["source"]["versions"][spec] = attributes["source"]["versions"][spec].presence
end
new(attributes)
end
@ -171,8 +176,8 @@ class Tab
"tap" => formula.tap&.name,
"spec" => formula.active_spec_sym.to_s,
"versions" => {
"stable" => formula.stable&.version.to_s,
"head" => formula.head&.version.to_s,
"stable" => formula.stable&.version&.to_s,
"head" => formula.head&.version&.to_s,
"version_scheme" => formula.version_scheme,
},
}