Module: EnolaRb::Surface

Defined in:
lib/enola_rb/surface.rb

Constant Summary collapse

REMEDY =
{
  upstream: "upgrade the enola gem to a release that carries it, or switch the Gemfile to munola",
  munola: "upgrade the munola gem"
}.freeze

Class Method Summary collapse

Class Method Details

.require!(name, binary:, channel: Enola.channel) ⇒ Object

Raises:

  • (Enola::Unavailable)


10
11
12
13
14
15
# File 'lib/enola_rb/surface.rb', line 10

def self.require!(name, binary:, channel: Enola.channel)
  return binary if Enola::Probe.new(binary).capabilities.fetch(name.to_sym, false)

  remedy = REMEDY.fetch(channel.name.to_sym, "upgrade the gem that pins this binary")
  raise Enola::Unavailable, "the #{channel} binary at #{binary} has no `#{name}` surface; #{remedy}"
end