Spec-Zone.ru › Homebrew

Модуль: DependenciesHelpers Закрытый

Включает:
Kernel
Включён в:
Homebrew::Cmd::Deps, Homebrew::Cmd::Uses
Определён в:
dependencies_helpers.rb,
dependencies_helpers.rbi

Этот модуль является частью закрытого API. Этот модуль можно использовать только в репозитории Homebrew/brew. Сторонним разработчикам по возможности не следует использовать этот модуль, поскольку он может быть удалён или изменён без предупреждения.

Краткое описание констант

Константы, включённые из Kernel

Kernel::IGNORE_INTERRUPTS_MUTEX

Краткое описание методов экземпляра свернуть

  • #args_includes_ignores(args) ⇒ Array<(Array<Symbol>, Array<Symbol>)> закрытый

    Эта сигнатура находится в RBI, чтобы избежать циклических зависимостей и ненужных подключений.

  • #dependents(formulae_or_casks) ⇒ Array<Formula, CaskDependent> закрытый
  • #recursive_dep_includes(root_dependent, includes, ignores) ⇒ Array<Dependency> закрытый
  • #recursive_includes(klass, root_dependent, includes, ignores) ⇒ Array<Dependency>, Requirements закрытый
  • #recursive_req_includes(root_dependent, includes, ignores) ⇒ Requirements закрытый
  • #select_includes(dependables, ignores, includes) ⇒ Array<Dependency, Requirement> закрытый

Методы, включённые из Kernel

#ensure_executable!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #quiet_system, #redirect_stdout, #safe_system, #which, #which_editor, #with_env, #with_homebrew_path

Подробное описание методов экземпляра

#args_includes_ignores(args) ⇒ Array<(Array<Symbol>, Array<Symbol>)>

Этот метод является частью приватного API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, так как он может быть удалён или изменён без предупреждения.

Эта сигнатура находится в RBI, чтобы избежать циклических зависимостей и ненужных инструкций require

Параметры:

  • args (Homebrew::Cmd::Deps::Args, Homebrew::Cmd::Uses::Args)

Возвращает:

  • (Array<(Array<Symbol>, Array<Symbol>)>)


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'dependencies_helpers.rb', line 8

def args_includes_ignores(args)
  includes = [:required?, :recommended?] # included by default
  includes << :implicit? if args.include_implicit?
  includes << :build? if args.include_build?
  includes << :test? if args.include_test?
  includes << :optional? if args.include_optional?

  ignores = []
  ignores << :recommended? if args.skip_recommended?
  ignores << :satisfied? if args.missing?

  [includes, ignores]
end

#dependents(formulae_or_casks) ⇒ Array<Formula, CaskDependent>

Этот метод является частью приватного API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, так как он может быть удалён или изменён без предупреждения.

Параметры:

  • formulae_or_casks (Array<Formula, Keg, Cask::Cask>)

Возвращает:

  • (Array<Formula, CaskDependent>)


83
84
85
86
87
88
89
90
91
92
# File 'dependencies_helpers.rb', line 83

def dependents(formulae_or_casks)
  formulae_or_casks.map do |formula_or_cask|
    case formula_or_cask
    when Formula then formula_or_cask
    when Cask::Cask then CaskDependent.new(formula_or_cask)
    else
      raise TypeError, "Unsupported type: #{formula_or_cask.class}"
    end
  end
end

#recursive_dep_includes(root_dependent, includes, ignores) ⇒ Array<Dependency>

Этот метод является частью приватного API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, так как он может быть удалён или изменён без предупреждения.

Параметры:

  • root_dependent (Formula, CaskDependent)
  • includes (Array<Symbol>)
  • ignores (Array<Symbol>)

Возвращает:

  • (Array<Dependency>)


26
27
28
# File 'dependencies_helpers.rb', line 26

def recursive_dep_includes(root_dependent, includes, ignores)
  T.cast(recursive_includes(Dependency, root_dependent, includes, ignores), T::Array[Dependency])
end

#recursive_includes(klass, root_dependent, includes, ignores) ⇒ Array<Dependency>, Requirements

Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. Сторонним разработчикам по возможности следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.

Параметры:

  • klass (T.class_of(Dependency), T.class_of(Requirement))
  • root_dependent (Formula, CaskDependent)
  • includes (Array<Symbol>)
  • ignores (Array<Symbol>)

Возвращает:

  • (Array<Dependency>, Requirements)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'dependencies_helpers.rb', line 46

def recursive_includes(klass, root_dependent, includes, ignores)
  cache_key = "recursive_includes_#{includes}_#{ignores}"

  klass.expand(root_dependent, cache_key:) do |dependent, dep|
    next Dependable::PRUNE if ignores.any? { |ignore| dep.public_send(ignore) }
    next Dependable::PRUNE if includes.none? do |include|
      # Ignore indirect test dependencies
      next if include == :test? && dependent != root_dependent

      dep.public_send(include)
    end

    # If a tap isn't installed, we can't find the dependencies of one of
    # its formulae and an exception will be thrown if we try.
    next Dependable::KEEP_BUT_PRUNE_RECURSIVE_DEPS if klass == Dependency && (tap = dep.tap) && !tap.installed?
  end
end

#recursive_req_includes(root_dependent, includes, ignores) ⇒ Requirements

Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. Сторонним разработчикам по возможности следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.

Параметры:

  • root_dependent (Formula, CaskDependent)
  • includes (Array<Symbol>)
  • ignores (Array<Symbol>)

Возвращает:

  • (Requirements)


34
35
36
# File 'dependencies_helpers.rb', line 34

def recursive_req_includes(root_dependent, includes, ignores)
  T.cast(recursive_includes(Requirement, root_dependent, includes, ignores), Requirements)
end

#select_includes(dependables, ignores, includes) ⇒ Array<Dependency, Requirement>

Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. Сторонним разработчикам по возможности следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.

Параметры:

  • dependables (Dependencies, Requirements, Array<Dependency>, Array<Requirement>)
  • ignores (Array<Symbol>)
  • includes (Array<Symbol>)

Возвращает:

  • (Array<Dependency, Requirement>)


71
72
73
74
75
76
77
# File 'dependencies_helpers.rb', line 71

def select_includes(dependables, ignores, includes)
  dependables.select do |dep|
    next false if ignores.any? { |ignore| dep.public_send(ignore) }

    includes.any? { |include| dep.public_send(include) }
  end
end

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

Spec-Zone.ru

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