Skip to content

Commit

Permalink
Load cask source with tap info
Browse files Browse the repository at this point in the history
This info is used in the installer to
decide whether to report analytics.
  • Loading branch information
apainintheneck committed Feb 28, 2023
1 parent fdc2e9f commit b91e93c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions Library/Homebrew/cask/cask_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def load(config:)
private

def cask(header_token, **options, &block)
Cask.new(header_token, source: content, **options, config: @config, &block)
Cask.new(header_token, source: content, tap: tap, **options, config: @config, &block)
end
end

Expand Down Expand Up @@ -146,18 +146,10 @@ def self.can_load?(ref)
super && !Tap.from_path(ref).nil?
end

attr_reader :tap

def initialize(path)
@tap = Tap.from_path(path)
super(path)
end

private

def cask(*args, &block)
super(*args, tap: tap, &block)
end
end

# Loads a cask from a specific tap.
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def load_installed_caskfile!
def load_cask_from_source_api!
options = { git_head: @cask.tap_git_head, sha256: @cask.ruby_source_checksum["sha256"] }
cask_source = Homebrew::API::Cask.fetch_source(@cask.token, **options)
@cask = CaskLoader::FromContentLoader.new(cask_source).load(config: @cask.config)
@cask = CaskLoader::FromContentLoader.new(cask_source, tap: @cask.tap).load(config: @cask.config)
end
end
end

0 comments on commit b91e93c

Please sign in to comment.