puma-plus-core 0.1.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e34b1ef06d0a1236642b404801bd239183bb0e0cba40df6d7362b850a6383300
4
+ data.tar.gz: f030593b78ae07fdd6dd3747c2196a1eeb7a378f1fe55c2371488ec391240357
5
+ SHA512:
6
+ metadata.gz: 0cf09236c05a70b008aad0022bb1c03874725707856becceb0560808f2bbe4afc80fda2400571fc327dd132d36d0711fab407f77fa61af4a6b9103b9f8904dcf
7
+ data.tar.gz: 34d5fed444595ac17d639ed67ec000e9400853abadd76be67259b17e9b40c36f4cfe53a23ec2c758f21fb16fcd97c601297a2f00d11451f56226227db30d06ec
Binary file
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Builds the Go server at install time.
4
+ #
5
+ # Not a C extension, despite living under ext/ and being named extconf.rb.
6
+ # RubyGems has exactly one hook that runs a build during `gem install`, and this
7
+ # is it -- so the file exists to satisfy that convention, writes a Makefile that
8
+ # runs `go build`, and compiles no C at all.
9
+ #
10
+ # This path only runs for the source gem. A platform gem
11
+ # (puma-plus-core-X.Y.Z-x86_64-linux) ships the binary already built and has no
12
+ # extension, so no Go toolchain is needed for the common install.
13
+
14
+ require "mkmf"
15
+ require "fileutils"
16
+
17
+ GEM_ROOT = File.expand_path("../..", __dir__)
18
+ EXE_DIR = File.join(GEM_ROOT, "exe")
19
+ EXE = File.join(EXE_DIR, RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "puma-plus-server.exe" : "puma-plus-server")
20
+ GO_SRC = File.join(GEM_ROOT, "go")
21
+
22
+ def abort_with(message)
23
+ # Written to stdout as well: RubyGems shows mkmf.log on failure, but the
24
+ # reason belongs where someone will actually see it.
25
+ warn message
26
+ File.write("Makefile", "all:\n\t@echo '#{message.lines.first.strip}'; exit 1\n")
27
+ exit 1
28
+ end
29
+
30
+ go = find_executable0("go")
31
+ unless go
32
+ abort_with(<<~MSG)
33
+ puma-plus-core: no Go toolchain found, and no prebuilt binary ships for this platform.
34
+
35
+ Either install Go #{PumaPlusGoMinimum = '1.24'} or newer, or install a platform-specific gem if one
36
+ exists for #{RUBY_PLATFORM}.
37
+ MSG
38
+ end
39
+
40
+ version = `#{go} version`.to_s[/go(\d+)\.(\d+)/, 0].to_s
41
+ unless version.empty?
42
+ major, minor = version.sub("go", "").split(".").map(&:to_i)
43
+ if major < 1 || (major == 1 && minor < 24)
44
+ abort_with("puma-plus-core: Go #{version} is too old; 1.24 or newer is required.")
45
+ end
46
+ end
47
+
48
+ unless File.directory?(GO_SRC)
49
+ abort_with("puma-plus-core: the gem is missing its Go sources at #{GO_SRC}.")
50
+ end
51
+
52
+ FileUtils.mkdir_p(EXE_DIR)
53
+
54
+ # A Makefile rather than shelling out here, so the build runs in the phase
55
+ # RubyGems expects and its output is captured the way a compile would be.
56
+ #
57
+ # The three-target shape matters and is not decoration. RubyGems runs
58
+ # `make clean`, `make`, `make install`, and then `make clean` AGAIN. A Makefile
59
+ # whose clean target removes the installed binary therefore deletes its own
60
+ # output on that last pass and reports success -- which is exactly what happened
61
+ # here: the gem installed, said nothing, and shipped an empty exe/ directory.
62
+ #
63
+ # So this mirrors what a C extension does. The build writes into this directory,
64
+ # install copies it out to exe/, and clean only removes the local copy.
65
+ #
66
+ # -mod=vendor is deliberate: the gem vendors its dependencies, so the build is
67
+ # offline and reproducible. An install that reached out to proxy.golang.org
68
+ # would fail in exactly the sandboxed and air-gapped environments people deploy
69
+ # from.
70
+ LOCAL = File.join(Dir.pwd, File.basename(EXE))
71
+
72
+ File.write("Makefile", <<~MAKE)
73
+ all:
74
+ \tcd #{GO_SRC} && #{go} build -mod=vendor -trimpath -ldflags "-s -w" -o #{LOCAL} ./cmd/puma-plus
75
+
76
+ install: all
77
+ \tmkdir -p #{EXE_DIR}
78
+ \tcp #{LOCAL} #{EXE}
79
+ \t@echo "puma-plus-core: installed #{EXE}"
80
+
81
+ clean:
82
+ \trm -f #{LOCAL}
83
+ MAKE
84
+
85
+ puts "puma-plus-core: will build #{EXE} with #{go}"
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PumaPlus
4
+ module Core
5
+ # Released in lockstep with puma-plus, which depends on this exact version.
6
+ #
7
+ # The Go server and the Ruby gem speak a private binary protocol with no
8
+ # version negotiation in the data path, so a mismatched pair is not a
9
+ # degraded install -- it is a broken one. Pinning exactly is cheaper than
10
+ # building negotiation for a pair that is always released together.
11
+ VERSION = "0.1.0"
12
+ end
13
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbconfig"
4
+
5
+ module PumaPlus
6
+ # Locates the compiled puma-plus server binary.
7
+ #
8
+ # This gem exists so that the Go server can be installed by RubyGems like
9
+ # anything else. It ships two ways:
10
+ #
11
+ # puma-plus-core-X.Y.Z.gem source; builds Go at install time
12
+ # puma-plus-core-X.Y.Z-x86_64-linux.gem the binary, already built
13
+ #
14
+ # A platform gem is preferred by RubyGems automatically when one matches, so
15
+ # the common case installs a binary and never needs a Go toolchain. The source
16
+ # gem is the fallback for platforms nobody has published, and it is the reason
17
+ # this is a separate gem from puma-plus at all: a native-platform gem can carry
18
+ # a precompiled Go binary only if it carries nothing that also needs compiling
19
+ # for the local Ruby, and puma-plus has a C extension that does.
20
+ module Core
21
+ # Where the binary lives once installed, either way it got there.
22
+ def self.binary_path
23
+ candidates.find { |p| File.executable?(p) && !File.directory?(p) }
24
+ end
25
+
26
+ def self.binary_path!
27
+ binary_path || raise(<<~MSG)
28
+ puma-plus-core is installed but has no server binary for this platform.
29
+
30
+ Looked in:
31
+ #{candidates.map { |c| " #{c}" }.join("\n")}
32
+
33
+ If this is a source install, the Go build did not produce a binary --
34
+ check the output of `gem install puma-plus-core`. A Go toolchain
35
+ (#{GO_MINIMUM}+) is required to build from source.
36
+ MSG
37
+ end
38
+
39
+ GO_MINIMUM = "1.24"
40
+
41
+ # exe/ is where both paths converge: the source build writes its output
42
+ # there so that a source install and a platform install are indistinguishable
43
+ # to everything downstream.
44
+ def self.candidates
45
+ root = File.expand_path("../..", __dir__)
46
+ [
47
+ File.join(root, "exe", exe_name),
48
+ File.join(root, "bin", exe_name)
49
+ ]
50
+ end
51
+
52
+ def self.exe_name
53
+ windows? ? "puma-plus-server.exe" : "puma-plus-server"
54
+ end
55
+
56
+ def self.windows?
57
+ RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/
58
+ end
59
+ end
60
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: puma-plus-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: aarch64-linux
6
+ authors:
7
+ - Evan Phoenix
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: |
13
+ The Go half of puma-plus: the HTTP/1.1, HTTP/2 and HTTP/3 frontend, the
14
+ request queue, and the scaling controller. Installed as a dependency of the
15
+ puma-plus gem; there is no reason to install it directly.
16
+ email:
17
+ - evan@miren.dev
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - exe/puma-plus-server
23
+ - ext/puma_plus_core/extconf.rb
24
+ - lib/puma_plus/core.rb
25
+ - lib/puma_plus/core/version.rb
26
+ homepage: https://github.com/evanphx/puma-plus
27
+ licenses:
28
+ - MIT
29
+ metadata:
30
+ source_code_uri: https://github.com/evanphx/puma-plus/tree/v0.1.0
31
+ rubygems_mfa_required: 'true'
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 3.2.0
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 4.0.16
47
+ specification_version: 4
48
+ summary: The puma-plus server binary
49
+ test_files: []