3rd party Cask - Error: ... Calling cask url do
blocks is deprecated! There is no replacement.
#5879
-
Output of
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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.
The deprecation message is a bit misleading, you can still have some more complex logic for the
url
block. The logic just needs to be moved into a separate function. For example, making a contrived example out of the existingacorn
cask:For your
pcloud-drive
cask, a refactoring to something like the following might work (I have not tested this withpcloud-drive
in particular):