Add error message with instructions for the missing cask file

This commit is contained in:
Rylan Polster 2023-02-05 15:35:11 +01:00
parent d7b1f19700
commit 0fd1be9a8e
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64

View File

@ -146,7 +146,17 @@ module Cask
caught_exceptions = [] caught_exceptions = []
upgradable_casks = outdated_casks.map { |c| [CaskLoader.load(c.installed_caskfile), c] } upgradable_casks = outdated_casks.map do |c|
if !c.installed_caskfile.exist? && c.tap.to_s == "homebrew/cask" &&
Homebrew::API::Cask.all_casks.key?(c.token)
odie <<~EOS
The cask '#{c.token}' was not properly installed and cannot be upgraded. To fix this, run:
brew reinstall --cask --force #{c.token}
EOS
end
[CaskLoader.load(c.installed_caskfile), c]
end
puts upgradable_casks puts upgradable_casks
.map { |(old_cask, new_cask)| "#{new_cask.full_name} #{old_cask.version} -> #{new_cask.version}" } .map { |(old_cask, new_cask)| "#{new_cask.full_name} #{old_cask.version} -> #{new_cask.version}" }