Class: CoreCaskTap Private
- Inherits:
-
AbstractCoreTap
- Object
- Tap
- AbstractCoreTap
- CoreCaskTap
- 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
Constants inherited from Tap
Instance Attribute Summary
Attributes inherited from Tap
#full_name, #git_repository, #name, #path, #repository, #user
Instance Method Summary collapse
- #cask_files ⇒ Array<Pathname> private
- #cask_files_by_name ⇒ Hash{String => Pathname} private
- #cask_renames ⇒ Hash{String => String} private
- #cask_tokens ⇒ Array<String> private
- #core_cask_tap? ⇒ Boolean private
- #initialize ⇒ void constructor private
- #new_cask_path(token) ⇒ Pathname private
- #tap_migrations ⇒ Hash private
- #to_internal_api_hash ⇒ Hash{String => T.untyped} private
Methods inherited from AbstractCoreTap
#ensure_installed!, 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?, #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, names, #new_formula_path, #official?, #potential_formula_dirs, #prefix_to_versioned_formulae_names, #private?, #pypi_formula_mappings, #relative_cask_path, #remote, #remote_repo, #remote_repository, #repo, #repo_var_suffix, #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 Cachable
Methods included from Enumerable
Constructor Details
#initialize ⇒ void
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.
1425 1426 1427 |
# File 'tap.rb', line 1425 def initialize super "Homebrew", "cask" end |
Instance Method Details
#cask_files ⇒ Array<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.
1445 1446 1447 1448 1449 |
# File 'tap.rb', line 1445 def cask_files return super if Homebrew::EnvConfig.no_install_from_api? cask_files_by_name.values end |
#cask_files_by_name ⇒ Hash{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.
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 |
# File 'tap.rb', line 1459 def cask_files_by_name return super if Homebrew::EnvConfig.no_install_from_api? @cask_files_by_name ||= 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 end |
#cask_renames ⇒ Hash{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.
1476 1477 1478 1479 1480 1481 1482 |
# File 'tap.rb', line 1476 def cask_renames @cask_renames ||= if Homebrew::EnvConfig.no_install_from_api? super else Homebrew::API::Cask.all_renames end end |
#cask_tokens ⇒ 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.
1452 1453 1454 1455 1456 |
# File 'tap.rb', line 1452 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.
1430 1431 1432 |
# File 'tap.rb', line 1430 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.
1435 1436 1437 1438 1439 1440 1441 1442 |
# File 'tap.rb', line 1435 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_migrations ⇒ Hash
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.
1485 1486 1487 1488 1489 1490 1491 1492 1493 |
# File 'tap.rb', line 1485 def tap_migrations @tap_migrations ||= if Homebrew::EnvConfig.no_install_from_api? super else migrations, = Homebrew::API.fetch_json_api_file "cask_tap_migrations.jws.json", stale_seconds: TAP_MIGRATIONS_STALE_SECONDS migrations end end |
#to_internal_api_hash ⇒ Hash{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.
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 |
# File 'tap.rb', line 1496 def to_internal_api_hash casks_api_hash = cask_tokens.to_h do |token| cask = Cask::CaskLoader.load(token) cask_hash = cask.to_hash_with_variations(hash_method: :to_internal_api_hash) [token, cask_hash] end { "tap_git_head" => git_head, "renames" => cask_renames, "tap_migrations" => tap_migrations, "casks" => casks_api_hash, } end |