Spec-Zone.ru › Homebrew

Class: Formulary::FormulaLoader Private

Inherits:
Object
  • Object
  • Formulary::FormulaLoader
show all
Includes:
Context, Utils::Output::Mixin
Defined in:
formulary.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 FormulaLoader returns instances of formulae. Subclasses implement loaders for particular sources of formulae.

Direct Known Subclasses

FormulaContentsLoader, FromAPILoader, FromBottleLoader, FromCacheLoader, FromKegLoader, FromPathLoader, FromTapLoader, FromURILoader, NullLoader

Instance Attribute Summary collapse

  • #alias_path ⇒ Pathname, ... readonly private

    The name used to install the formula.

  • #name ⇒ String readonly private

    The formula's name.

  • #path ⇒ Pathname readonly private

    The formula file's path.

  • #tap ⇒ Tap? readonly private

    The formula's tap (nil if it should be implicitly determined).

Instance Method Summary collapse

  • #get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) ⇒ Formula private

    Gets the formula instance.

  • #initialize(name, path, alias_path: nil, tap: nil) ⇒ void constructor private
  • #klass(flags:, ignore_errors:) ⇒ T.class_of(Formula) private

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

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(name, path, alias_path: nil, tap: nil) ⇒ 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:

  • name (String)
  • path (Pathname)
  • alias_path (Pathname, String, nil) (defaults to: nil)
  • tap (Tap, nil) (defaults to: nil)


482
483
484
485
486
487
# File 'formulary.rb', line 482

def initialize(name, path, alias_path: nil, tap: nil)
  @name = name
  @path = path
  @alias_path = alias_path
  @tap = tap
end

Instance Attribute Details

#alias_path ⇒ Pathname, ... (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.

The name used to install the formula.

Returns:

  • (Pathname, String, nil)


473
474
475
# File 'formulary.rb', line 473

def alias_path
  @alias_path
end

#name ⇒ String (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.

The formula's name.

Returns:

  • (String)


465
466
467
# File 'formulary.rb', line 465

def name
  @name
end

#path ⇒ Pathname (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.

The formula file's path.

Returns:

  • (Pathname)


469
470
471
# File 'formulary.rb', line 469

def path
  @path
end

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

The formula's tap (nil if it should be implicitly determined).

Returns:

  • (Tap, nil)


477
478
479
# File 'formulary.rb', line 477

def tap
  @tap
end

Instance Method Details

#get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) ⇒ Formula

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.

Gets the formula instance. alias_path can be overridden here in case an alias was used to refer to a formula that was loaded in another way.

Parameters:

  • spec (Symbol)
  • alias_path (Pathname, String, nil) (defaults to: nil)
  • force_bottle (Boolean) (defaults to: false)
  • flags (Array<String>) (defaults to: [])
  • ignore_errors (Boolean) (defaults to: false)

Returns:

  • (Formula)


501
502
503
504
505
506
# File 'formulary.rb', line 501

def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false)
  alias_path ||= self.alias_path
  alias_path = Pathname(alias_path) if alias_path.is_a?(String)
  klass(flags:, ignore_errors:)
    .new(name, path, spec, alias_path:, tap:, force_bottle:)
end

#klass(flags:, ignore_errors:) ⇒ T.class_of(Formula)

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:

  • flags (Array<String>)
  • ignore_errors (Boolean)

Returns:

  • (T.class_of(Formula))


509
510
511
512
# File 'formulary.rb', line 509

def klass(flags:, ignore_errors:)
  load_file(flags:, ignore_errors:) unless Formulary.formula_class_defined_from_path?(path)
  Formulary.formula_class_get_from_path(path)
end

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

Spec-Zone.ru

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