Top Level Namespace

Defined Under Namespace

Modules: PumaPlus

Constant Summary collapse

GEM_ROOT =
File.expand_path("../..", __dir__)
EXE_DIR =
File.join(GEM_ROOT, "exe")
EXE =
File.join(EXE_DIR, RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "puma-plus-server.exe" : "puma-plus-server")
GO_SRC =
File.join(GEM_ROOT, "go")
LOCAL =

A Makefile rather than shelling out here, so the build runs in the phase RubyGems expects and its output is captured the way a compile would be.

The three-target shape matters and is not decoration. RubyGems runs make clean, make, make install, and then make clean AGAIN. A Makefile whose clean target removes the installed binary therefore deletes its own output on that last pass and reports success -- which is exactly what happened here: the gem installed, said nothing, and shipped an empty exe/ directory.

So this mirrors what a C extension does. The build writes into this directory, install copies it out to exe/, and clean only removes the local copy.

-mod=vendor is deliberate: the gem vendors its dependencies, so the build is offline and reproducible. An install that reached out to proxy.golang.org would fail in exactly the sandboxed and air-gapped environments people deploy from.

File.join(Dir.pwd, File.basename(EXE))

Instance Method Summary collapse

Instance Method Details

#abort_with(message) ⇒ Object



22
23
24
25
26
27
28
# File 'ext/puma_plus_core/extconf.rb', line 22

def abort_with(message)
  # Written to stdout as well: RubyGems shows mkmf.log on failure, but the
  # reason belongs where someone will actually see it.
  warn message
  File.write("Makefile", "all:\n\t@echo '#{message.lines.first.strip}'; exit 1\n")
  exit 1
end