Class: Formulary::FromPathLoader Private
- Inherits:
-
FormulaLoader
- Object
- FormulaLoader
- Formulary::FromPathLoader
- 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.
Loads formulae from disk using a path.
Instance Attribute Summary
Attributes inherited from FormulaLoader
#alias_path, #name, #path, #tap
Class Method Summary collapse
- .from_path(path) ⇒ T.attached_class, ... private
- .try_new(_ref, from: nil, warn: false) ⇒ nil private
Instance Method Summary collapse
- #initialize(path, alias_path: nil, tap: nil) ⇒ void constructor private
Methods inherited from FormulaLoader
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_incompatible, #pretty_install_status, #pretty_installed, #pretty_removed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from Context
current, current=, #debug?, #deferred_environment_expansion?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(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.
498 499 500 501 502 503 504 505 506 507 |
# File 'formulary.rb', line 498 def initialize(path, alias_path: nil, tap: nil) path = Pathname(path). name = path.basename(".rb").to_s alias_path = alias_path&. alias_dir = alias_path&.dirname alias_path = nil if alias_dir != tap&.alias_dir super(name, path, alias_path:, tap:) end |
Class Method Details
.from_path(path) ⇒ 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.
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'formulary.rb', line 466 def self.from_path(path) path = Pathname(path) return unless path..exist? if (tap = Tap.from_path(path)) # Only treat symlinks in taps as aliases. if path.symlink? alias_path = path path = Utils::Path.resolved_path(alias_path) end else # Don't treat cache symlinks as aliases. tap = Homebrew::API.tap_from_source_download(path) end return if path.extname != ".rb" if path.parent.basename.to_s == ".brew" begin keg = Keg.for(path) rescue NotAKegError keg = nil end if keg && path.realpath == keg/".brew/#{keg.name}.rb" return FromKegLoader.new(keg.name, path, tap: keg.tab.tap) end end new(path, alias_path:, tap:) end |
.try_new(_ref, from: nil, warn: false) ⇒ nil
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.
458 459 460 461 |
# File 'formulary.rb', line 458 def self.try_new(_ref, from: nil, warn: false) Formulary.odeprecated "Formulary::FromPathLoader.try_new", "Formulary.from_path" nil end |