3rd party Cask - Error: ... Calling cask url do
blocks is deprecated! There is no replacement.
#5879
Unanswered
trinitronx
asked this question in
Tap maintenance and brew development
Replies: 1 comment
-
The deprecation message is a bit misleading, you can still have some more complex logic for the cask "acorn" do
# [...]
def construct_url
app_name = "A" + "c" + "o" + "r" + "n"
"https://flyingmeat.com/download/#{app_name}-#{version}.zip"
end
url construct_url # calls construct_url and passes the return value of it as an input to url
# [...]
end For your cask "pcloud-drive" do
# [...]
def construct_url
require "net/http"
require "json"
api = "https://api.pcloud.com/"
uri = URI(api + "getpublinkdownload?code=" + code)
response = Net::HTTP.get(uri)
data = JSON.parse(response)
"https://" + data["hosts"][0] + data["path"]
end
url construct_url
# [...]
end This still would not pass muster for inclusion in the main |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Output of
brew config
Output of
brew doctor
Description of issue
I maintain a 3rd-party Tap,
LyraPhase/homebrew-pcloud
, which needed some special URL handling due to the application publisher's nonstandard URL scheme using a downloadcode
parameter.To get this working, the
pcloud-drive
Cask used a "url do
" block. Apparently, this was marked as a RuboCop warning in Homebrew/brew#18404 which was supposed to still allow 3rd-party Taps to use this functionality.However, evidently it was later deprecated with no replacement in Homebrew/brew#18407.
Now when issuing
brew
commands which load this Cask, a fatalError
is returned:Unfortunately the download URL for pCloud Drive has a unique download "
code
" parameter, so it requires usage of aurl do
block, or some other method to perform an API request to get the real download URL.This was the reason that this Cask was rejected by
homebrew-cask
(see: Homebrew/homebrew-cask#57634). So, I opted to maintain a 3rd-parth Cask to allow for installation of this software using Homebrew.Is there some other currently working method or workaround for doing what this Cask needs to do?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions