Class: Formulary::FormulaLoader Private

Inherits:
Object
  • Object
show all
Includes:
Context
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Context

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

Constructor Details

#initialize(name, path) ⇒ FormulaLoader

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 a new instance of FormulaLoader.



170
171
172
173
# File 'formulary.rb', line 170

def initialize(name, path)
  @name = name
  @path = path.resolved_path
end

Instance Attribute Details

#alias_pathObject (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



168
169
170
# File 'formulary.rb', line 168

def alias_path
  @alias_path
end

#nameObject (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



164
165
166
# File 'formulary.rb', line 164

def name
  @name
end

#pathObject (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 ruby file’s path or filename



166
167
168
# File 'formulary.rb', line 166

def path
  @path
end

Instance Method Details

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

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.



178
179
180
181
182
# File 'formulary.rb', line 178

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

#klass(flags:, ignore_errors:) ⇒ Object

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.



184
185
186
187
# File 'formulary.rb', line 184

def klass(flags:, ignore_errors:)
  load_file(flags: flags, ignore_errors: ignore_errors) unless Formulary.formula_class_defined?(path)
  Formulary.formula_class_get(path)
end