To fix this error, I believe we should simply use the Cask::Cask#installed_version method instead of calling .versions.first on the cask variable in Bcu::Pin::Add#run_add_pin.
Here are the steps to reproduce+fix the issue on your side.
brew info --cask deepl
# ==> deepl: 4.5.542015 (auto_updates)
# https://www.deepl.com/
# /opt/homebrew/Caskroom/deepl/4.4.513804 (119B)
brew cu pin deepl
# Error: undefined method `versions' for #<Cask deepl>
At this stage, simply apply the fix to your local install of homebrew-cask-upgrade:
# macOS/BSD syntax
sed -i '' -E 's/(cask\.)versions\.first/\1installed_version/' \
"$HOMEBREW_REPOSITORY/Library/Taps/buo/homebrew-cask-upgrade/lib/bcu/command/pin_add.rb"
Pinning should now be working again:
brew cu unpin deepl
# Unpinned: deepl
brew cu pin deepl
# Pinned: deepl in version 4.4.513804
(optionally) Clean your local install (which reverts to the broken version):
cd "$HOMEBREW_REPOSITORY/Library/Taps/buo/homebrew-cask-upgrade/" && git checkout -- .
fixes #231
To fix this error, I believe we should simply use the
Cask::Cask#installed_version
method instead of calling.versions.first
on thecask
variable inBcu::Pin::Add#run_add_pin
.Here are the steps to reproduce+fix the issue on your side.
At this stage, simply apply the fix to your local install of homebrew-cask-upgrade:
Pinning should now be working again:
(optionally) Clean your local install (which reverts to the broken version):