Exception: BuildFlagsError

Inherits:
RuntimeError
  • Object
show all
Defined in:
exceptions.rb

Overview

Raised by Homebrew.install, Homebrew.reinstall, and Homebrew.upgrade if the user passes any flags/environment that would case a bottle-only installation on a system without build tools to fail.

Instance Method Summary collapse

Constructor Details

#initialize(flags, bottled: true) ⇒ BuildFlagsError

Returns a new instance of BuildFlagsError.



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'exceptions.rb', line 545

def initialize(flags, bottled: true)
  if flags.length > 1
    flag_text = "flags"
    require_text = "require"
  else
    flag_text = "flag"
    require_text = "requires"
  end

  bottle_text = if bottled
    <<~EOS
      Alternatively, remove the #{flag_text} to attempt bottle installation.
    EOS
  end

  message = <<~EOS
    The following #{flag_text}:
      #{flags.join(", ")}
    #{require_text} building tools, but none are installed.
    #{DevelopmentTools.installation_instructions}#{bottle_text}
  EOS

  super message
end