Module: Dependable

Included in:
Dependency, Requirement
Defined in:
brew/Library/Homebrew/dependable.rb

Constant Summary collapse

RESERVED_TAGS =

:run and :linked are no longer used but keep them here to avoid them being misused in future.

[:build, :optional, :recommended, :run, :test, :linked].freeze

Instance Method Summary collapse

Instance Method Details

#build?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'brew/Library/Homebrew/dependable.rb', line 10

def build?
  tags.include? :build
end

#option_tagsObject



30
31
32
# File 'brew/Library/Homebrew/dependable.rb', line 30

def option_tags
  tags - RESERVED_TAGS
end

#optional?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'brew/Library/Homebrew/dependable.rb', line 14

def optional?
  tags.include? :optional
end

#optionsObject



34
35
36
# File 'brew/Library/Homebrew/dependable.rb', line 34

def options
  Options.create(option_tags)
end

#prune_from_option?(build) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'brew/Library/Homebrew/dependable.rb', line 38

def prune_from_option?(build)
  return if !optional? && !recommended?

  build.without?(self)
end

#prune_if_build_and_not_dependent?(dependent, formula = nil) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
48
49
# File 'brew/Library/Homebrew/dependable.rb', line 44

def prune_if_build_and_not_dependent?(dependent, formula = nil)
  return false unless build?
  return dependent.installed? unless formula

  dependent != formula
end

#recommended?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'brew/Library/Homebrew/dependable.rb', line 18

def recommended?
  tags.include? :recommended
end

#required?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'brew/Library/Homebrew/dependable.rb', line 26

def required?
  !build? && !test? && !optional? && !recommended?
end

#test?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'brew/Library/Homebrew/dependable.rb', line 22

def test?
  tags.include? :test
end