Class: Homebrew::Bundle::Checker::FlatpakChecker Private

Inherits:
Base
  • Object
show all
Defined in:
bundle/flatpak_checker.rb

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.

Constant Summary collapse

PACKAGE_TYPE =

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

:flatpak
PACKAGE_TYPE_NAME =

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

"Flatpak"

Instance Method Summary collapse

Methods inherited from Base

#checkable_entries, #exit_early_check, #full_check

Instance Method Details

#failure_reason(package, no_upgrade:) ⇒ String

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:



30
31
32
33
# File 'bundle/flatpak_checker.rb', line 30

def failure_reason(package, no_upgrade:)
  name = package.is_a?(Hash) ? package[:name] : package
  "#{PACKAGE_TYPE_NAME} #{name} needs to be installed."
end

#find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String>

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:

  • entries (Array<Homebrew::Bundle::Dsl::Entry>)
  • exit_on_first_error (Boolean) (defaults to: false)
  • no_upgrade (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)

Returns:



17
18
19
# File 'bundle/flatpak_checker.rb', line 17

def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false)
  super
end

#format_checkable(entries) ⇒ Array<Hash{Symbol => T.untyped}>

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.

Override to return entry hashes with options instead of just names

Parameters:

Returns:



23
24
25
26
27
# File 'bundle/flatpak_checker.rb', line 23

def format_checkable(entries)
  checkable_entries(entries).map do |entry|
    { name: entry.name, options: entry.options || {} }
  end
end

#installed_and_up_to_date?(package, no_upgrade: false) ⇒ 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:

  • package (String, Hash{Symbol => T.untyped})
  • no_upgrade (Boolean) (defaults to: false)

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'bundle/flatpak_checker.rb', line 38

def installed_and_up_to_date?(package, no_upgrade: false)
  require "bundle/flatpak_installer"

  if package.is_a?(Hash)
    name = package[:name]
    remote = package.dig(:options, :remote) || "flathub"
    url = package.dig(:options, :url)

    # 3-tier remote handling:
    # - Tier 1: Named remote → check with that remote name
    # - Tier 2: URL only → resolve to single-app remote name (<app-id>-origin)
    # - Tier 3: URL + name → check with the named remote
    actual_remote = if url.blank? && remote.start_with?("http://", "https://")
      # Tier 2: URL only - resolve to single-app remote name
      # (.flatpakref - check by name only since remote name varies)
      return Homebrew::Bundle::FlatpakInstaller.package_installed?(name) if remote.end_with?(".flatpakref")

      Homebrew::Bundle::FlatpakInstaller.generate_single_app_remote_name(name)
    else
      # Tier 1 (named remote) and Tier 3 (named remote with URL) both use the remote name
      remote
    end

    Homebrew::Bundle::FlatpakInstaller.package_installed?(name, remote: actual_remote)
  else
    # If just a string, check without remote
    Homebrew::Bundle::FlatpakInstaller.package_installed?(package)
  end
end