Skip to content

URL do block with custom downloader strategy #718

Answered by marble-sh
marble-sh asked this question in Casks
Discussion options

You must be logged in to vote

The trouble seems to be in this block of code in dls.rb:

https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cask/dsl.rb#L184

    def url(*args, **options)
      caller_location = caller_locations[0]

      set_unique_stanza(:url, args.empty? && options.empty? && !block_given?) do
        if block_given?
          LazyObject.new { URL.new(*yield, from_block: true, caller_location: caller_location) }
        else
          URL.new(*args, **options, caller_location: caller_location)
        end
      end
    end

URL.new inside the LazyObject is missing **options in the arguments list; adding options to the argument list allowed me to do

  url using: MyDownloadStrategy do
    some_url

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@vitorgalvao
Comment options

@marble-sh
Comment options

Answer selected by marble-sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Casks
Labels
None yet
3 participants