Class: CoreCaskTap Private

Inherits:
AbstractCoreTap show all
Defined in:
tap/core_cask_tap.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.

A specialized Tap class for homebrew-cask.

Constant Summary collapse

Cache =

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.

type_member { { fixed: T::Hash[T.any(String, Symbol), T.untyped] } }
Elem =

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.

type_member(:out) { { fixed: Tap } }

Constants inherited from Tap

Tap::GITHUB_REMOTE_PREFIX_REGEX, Tap::HOMEBREW_TAP_JSON_FILES, Tap::NORMALIZE_REMOTE_HOSTS, Tap::REMOTE_HOST_REGEX, Tap::REMOTE_SCHEME_USERINFO_REGEX

Instance Attribute Summary

Attributes inherited from Tap

#full_name, #full_repository, #git_repository, #name, #path, #repository, #user

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCoreTap

#ensure_installed!, #formula_file_to_name, #implicitly_trusted?, #should_report_analytics?

Methods inherited from Tap

#alias_dir, #alias_file_to_name, #alias_files, #alias_reverse_table, #alias_table, #aliases, all, #allow_bump?, #allowed_by_env?, allowed_taps, #apply_redirected_remote!, #audit_exception, #audit_exceptions, #autobump, #canonical_remote?, #cask_dir, #cask_file?, #cask_reverse_renames, #clear_cache, #command_dir, #command_files, #config, #contents, #core_tap?, core_taps, #custom_remote?, #default_remote, #disabled_new_usr_local_relocation_formulae, each, #ensure_installed!, fetch, #fix_remote_configuration, #forbidden_by_env?, forbidden_taps, #formula_dir, #formula_file?, #formula_file_to_name, #formula_files, #formula_files_by_name, #formula_names, #formula_renames, #formula_reverse_renames, from_path, #git?, #git_branch, #git_command!, #git_head, #git_last_commit, #implicitly_trusted?, #install, installed, #installed?, #issues_url, #link_completions_and_manpages, #matches_reference?, #new_formula_path, normalize_remote, #official?, #official_git_checkout?, #potential_formula_dirs, #prefix_to_versioned_formulae_names, #private?, #reference, #relative_cask_path, #remote, remote_reference?, #remote_repository, remote_to_reference, #repository_var_suffix, #reverse_tap_migrations_renames, same_remote?, #shallow?, #should_report_analytics?, #style_exceptions, #synced_versions_formulae, tap_list_references, tap_migration_oldnames, #to_hash, #uninstall, untapped_official_taps, #update_remote_from_git_redirect!, #uses_custom_remote?, with_cask_token, with_formula_name, #worktree_source_tap_path_for

Methods included from Enumerable

#compact_blank, #exclude?

Methods included from Cachable

#cache, #clear_cache

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Methods included from Utils::Path

formula_installed_prefixes, formula_opt_bin_env, formula_opt_bin_path, install_info, loadable_package_path?, uninstall_info

Methods included from Utils::Path::Helpers

#child_of?, #cp_path_sub, #ensure_child_of!, #ensure_writable, #resolved_path, #resolved_path_exists?, #rmdir_if_possible, #text_executable?

Methods included from Utils::Path::FormulaHelpers

#formula_any_version_installed?, #formula_opt_bin, #formula_opt_include, #formula_opt_lib, #formula_opt_libexec, #formula_opt_prefix

Constructor Details

#initializevoid

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.



20
21
22
# File 'tap/core_cask_tap.rb', line 20

def initialize
  super "Homebrew", "cask"
end

Class Method Details

.instanceCoreCaskTap

This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Get the singleton instance for this Tap.

Returns:



15
16
17
# File 'tap/core_cask_tap.rb', line 15

def self.instance
  @instance ||= T.let(new, T.nilable(CoreCaskTap))
end

Instance Method Details

#cask_filesArray<Pathname>

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.

Returns:



44
45
46
47
48
# File 'tap/core_cask_tap.rb', line 44

def cask_files
  return super if Homebrew::EnvConfig.no_install_from_api?

  cask_files_by_name.values
end

#cask_files_by_nameHash{String => Pathname}

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.

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'tap/core_cask_tap.rb', line 58

def cask_files_by_name
  return super if Homebrew::EnvConfig.no_install_from_api?

  @cask_files_by_name ||= T.let(
    begin
      cask_directory_path = cask_dir.to_s
      Homebrew::API.cask_tokens.each_with_object({}) do |name, hash|
        # If there's more than one item with the same path: use the longer one to prioritise more specific results.
        existing_path = hash[name]
        # Pathname equivalent is slow in a tight loop
        new_path = File.join(cask_directory_path, new_cask_subdirectory(name), "#{name.downcase}.rb")
        hash[name] = Pathname(new_path) if existing_path.nil? || existing_path.to_s.length < new_path.length
      end
    end,
    T.nilable(T::Hash[String, Pathname]),
  )
end

#cask_renamesHash{String => 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.

Returns:



77
78
79
80
81
82
83
84
85
86
# File 'tap/core_cask_tap.rb', line 77

def cask_renames
  @cask_renames ||= T.let(
    if Homebrew::EnvConfig.no_install_from_api?
      super
    else
      Homebrew::API.cask_renames
    end,
    T.nilable(T::Hash[String, String]),
  )
end

#cask_tokensArray<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.

Returns:



51
52
53
54
55
# File 'tap/core_cask_tap.rb', line 51

def cask_tokens
  return super if Homebrew::EnvConfig.no_install_from_api?

  Homebrew::API.cask_tokens
end

#core_cask_tap?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.

Returns:

  • (Boolean)


25
26
27
# File 'tap/core_cask_tap.rb', line 25

def core_cask_tap?
  true
end

#new_cask_path(token) ⇒ Pathname

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:



39
40
41
# File 'tap/core_cask_tap.rb', line 39

def new_cask_path(token)
  cask_dir/new_cask_subdirectory(token)/"#{token.downcase}.rb"
end

#new_cask_subdirectory(token) ⇒ 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
34
35
36
# File 'tap/core_cask_tap.rb', line 30

def new_cask_subdirectory(token)
  if token.start_with?("font-")
    "font/font-#{token.delete_prefix("font-")[0]}"
  else
    token[0].to_s
  end
end

#tap_migrationsHash{String => 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.

Returns:



89
90
91
92
93
94
95
96
97
98
# File 'tap/core_cask_tap.rb', line 89

def tap_migrations
  @tap_migrations ||= T.let(
    if Homebrew::EnvConfig.no_install_from_api?
      super
    else
      Homebrew::API.cask_tap_migrations
    end,
    T.nilable(T::Hash[String, T.untyped]),
  )
end