Class: CoreCaskTap Private

Inherits:
AbstractCoreTap show all
Defined in:
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

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::HOMEBREW_TAP_JSON_FILES

Instance Attribute Summary

Attributes inherited from Tap

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

Instance Method Summary collapse

Methods inherited from AbstractCoreTap

#ensure_installed!, #formula_file_to_name, instance, #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, #audit_exception, #audit_exceptions, #autobump, #cask_dir, #cask_file?, #cask_reverse_renames, #clear_cache, #command_dir, #command_files, #config, #contents, #core_tap?, core_taps, #custom_remote?, #default_remote, 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_head, #git_last_commit, #install, installed, #installed?, #issues_url, #link_completions_and_manpages, #new_formula_path, #official?, #potential_formula_dirs, #prefix_to_versioned_formulae_names, #private?, #pypi_formula_mappings, #relative_cask_path, #remote, #remote_repository, #repository_var_suffix, #reverse_tap_migrations_renames, #shallow?, #should_report_analytics?, #style_exceptions, #synced_versions_formulae, tap_migration_oldnames, #to_hash, #uninstall, untapped_official_taps, with_cask_token, with_formula_name

Methods included from Enumerable

#compact_blank, #exclude?

Methods included from Cachable

#cache, #clear_cache

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.



1494
1495
1496
# File 'tap.rb', line 1494

def initialize
  super "Homebrew", "cask"
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:



1514
1515
1516
1517
1518
# File 'tap.rb', line 1514

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:



1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
# File 'tap.rb', line 1528

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

  @cask_files_by_name ||= T.let(
    begin
      tap_path = path.to_s
      Homebrew::API::Cask.all_casks.each_with_object({}) do |item, hash|
        name, cask_hash = item
        # 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(tap_path, cask_hash.fetch("ruby_source_path"))
        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:



1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'tap.rb', line 1548

def cask_renames
  @cask_renames ||= T.let(
    if Homebrew::EnvConfig.no_install_from_api?
      super
    else
      Homebrew::API::Cask.all_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:



1521
1522
1523
1524
1525
# File 'tap.rb', line 1521

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

  Homebrew::API::Cask.all_casks.keys
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)


1499
1500
1501
# File 'tap.rb', line 1499

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:



1504
1505
1506
1507
1508
1509
1510
1511
# File 'tap.rb', line 1504

def new_cask_path(token)
  cask_subdir = if token.start_with?("font-")
    "font/font-#{token.delete_prefix("font-")[0]}"
  else
    token[0].to_s
  end
  cask_dir/cask_subdir/"#{token.downcase}.rb"
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:



1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
# File 'tap.rb', line 1560

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