Spec-Zone.ru › Homebrew

Class: Cask::CaskLoader::FromTapLoader Private

Inherits:
FromPathLoader
  • Object
  • AbstractContentLoader
  • FromPathLoader
  • Cask::CaskLoader::FromTapLoader
show all
Defined in:
cask/cask_loader.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.

Loads a cask from a specific tap.

Direct Known Subclasses

FromNameLoader

Instance Attribute Summary collapse

  • #tap ⇒ Tap readonly private

Attributes inherited from FromPathLoader

#path, #token

Attributes inherited from AbstractContentLoader

#content

Class Method Summary collapse

  • .loader_from_token_tap_type(token_tap_type) ⇒ T.attached_class, ... private
  • .try_new(ref, warn: false) ⇒ T.attached_class, ... private

Instance Method Summary collapse

  • #initialize(tapped_token) ⇒ void constructor private
  • #load(config:) ⇒ Cask private

Methods inherited from FromPathLoader

invalid_path?

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_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning

Constructor Details

#initialize(tapped_token) ⇒ 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.

Parameters:

  • tapped_token (String)


330
331
332
333
334
335
336
337
338
# File 'cask/cask_loader.rb', line 330

def initialize(tapped_token)
  tap_with_token = Tap.with_cask_token(tapped_token)
  raise "unexpected nil Tap.with_cask_token" unless tap_with_token

  tap, token = tap_with_token
  cask = CaskLoader.find_cask_in_tap(token, tap)
  super cask
  @tap = T.let(tap, Tap)
end

Instance Attribute Details

#tap ⇒ Tap (readonly)

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:

  • (Tap)


300
301
302
# File 'cask/cask_loader.rb', line 300

def tap
  @tap
end

Class Method Details

.loader_from_token_tap_type(token_tap_type) ⇒ T.attached_class, ...

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:

  • token_tap_type (Array<(String, Tap, [Symbol, nil])>)

Returns:

  • (T.attached_class, FromAPILoader, nil)


319
320
321
322
323
324
325
326
327
# File 'cask/cask_loader.rb', line 319

def self.loader_from_token_tap_type(token_tap_type)
  token, tap, type = token_tap_type

  if type == :migration && tap.core_cask_tap? && (loader = FromAPILoader.try_new(token))
    loader
  else
    new("#{tap}/#{token}")
  end
end

.try_new(ref, warn: false) ⇒ T.attached_class, ...

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:

  • ref (String, Pathname, Cask, URI::Generic)
  • warn (Boolean) (defaults to: false)

Returns:

  • (T.attached_class, FromAPILoader, nil)


307
308
309
310
311
312
313
# File 'cask/cask_loader.rb', line 307

def self.try_new(ref, warn: false)
  ref = ref.to_s

  return unless (token_tap_type = CaskLoader.tap_cask_token_type(ref, warn:))

  loader_from_token_tap_type(token_tap_type)
end

Instance Method Details

#load(config:) ⇒ Cask

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:

  • config (Config, nil)

Returns:

  • (Cask)

Raises:

  • (TapCaskUnavailableError)


341
342
343
344
345
# File 'cask/cask_loader.rb', line 341

def load(config:)
  raise TapCaskUnavailableError.new(tap, token) unless tap.installed?

  super
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Cask/CaskLoader/FromTapLoader.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API