Class: Homebrew::DevCmd::GenerateCaskFeeds::Feeds Private

Inherits:
Utils::Analytics::PackageFeeds show all
Defined in:
dev-cmd/generate-cask-feeds.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Supplies cask metadata to the shared feed generator.

Constant Summary

Constants inherited from Utils::Analytics::PackageFeeds

Utils::Analytics::PackageFeeds::BATCH_SIZE, Utils::Analytics::PackageFeeds::Builds, Utils::Analytics::PackageFeeds::Entry, Utils::Analytics::PackageFeeds::LIMITS

Instance Method Summary collapse

Methods inherited from Utils::Analytics::PackageFeeds

#builds, #changes, #generate, #initialize, write

Constructor Details

This class inherits a constructor from Utils::Analytics::PackageFeeds

Instance Method Details

#package_path?(path) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Boolean)


54
55
56
57
# File 'dev-cmd/generate-cask-feeds.rb', line 54

def package_path?(path)
  path = "Casks/#{path.delete_prefix("Cask/")}" if path.start_with?("Cask/")
  CoreCaskTap.instance.cask_file?(path)
end

#read_builds(path, blob, source) ⇒ Builds

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'dev-cmd/generate-cask-feeds.rb', line 33

def read_builds(path, blob, source)
  cask = T.let(nil, T.nilable(Cask::Cask))
  @history.targets.each do |os, arch|
    cask = Homebrew::SimulateSystem.with(os:, arch:) { Cask::CaskLoader.from_content(source) }
    break
  rescue Cask::CaskInvalidError, Cask::CaskUnreadableError
    next
  end
  if cask.nil? || cask.token != File.basename(path, ".rb")
    raise "Cannot read cask metadata for #{path} at #{blob}"
  end

  @history.targets.to_h do |os, arch|
    version = cask.refresh_for_tag(::Utils::Bottles::Tag.new(system: os, arch:)) do
      cask.version&.to_s
    end
    ["#{os}/#{arch}", Utils::Analytics::FormulaHistory::Build.new(version:)]
  end
end