[rubygems/rubygems] better error message if cargo metadata doesn't contain the package we expect

https://github.com/rubygems/rubygems/commit/cb7e6d1577
This commit is contained in:
Mat Sadler 2023-01-26 20:32:05 -08:00 коммит произвёл git
Родитель b4defea362
Коммит c5a34f5b56
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -225,6 +225,17 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# avoid the json dependency
metadata = Gem::SafeYAML.safe_load(output)
package = metadata["packages"].find {|pkg| pkg["manifest_path"] == manifest_path }
unless package
found = metadata["packages"].map {|md| "#{md["name"]} at #{md["manifest_path"]}" }
raise Gem::InstallError, <<-EOF
failed to determine cargo package name
looking for: #{manifest_path}
found:
#{found.join("\n")}
EOF
end
package["name"].tr("-", "_")
end