libbeachcomber 0.6.0 → 0.6.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/beachcomber/discovery.rb +14 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5895c44fbc17e34a043845428bffda24b355679d6d02bfa322b81f90a732ca
4
- data.tar.gz: c3b583ca4c94cf046a015c0ee914ae77113d83d670392bb9e5fd0a5e1b4d4529
3
+ metadata.gz: 49948fed9514c126aa098f0d469d9d00b455dfee1e295734459aa19d3d5e72be
4
+ data.tar.gz: 8d0ae8bc11f78cada0741b3cd2a668dc1a97d2a68299ca9fc37acb1d6a2806ba
5
5
  SHA512:
6
- metadata.gz: fe43031c1ea0b00bab8a280fa61bcef5de14473b88e2c036d3af9063945bde5e87f3858d37fa6a48954d567551c1568831c05655140063cda6f0c5aa1f1a39ba
7
- data.tar.gz: 71baf44b81f858af49b1dc2db54f3949f5003d0b00ab4f02add2e3b193155748dec8ca1c3154d491a46e69aaa9825c47898efa493a2b2a06ba433897dbb1f328
6
+ metadata.gz: a6e7f9bfbd336707802e4d45b9a797cf2ba6ee393fded7e674932a87be8d37169709af1142a0620b5087be38b6a3a7d47f26e5750e422cd0786bcb203f327c67
7
+ data.tar.gz: 62d84ba78bd44bcdff01f7ec990b5f3ba6ffa8760de1f7d8f83ed9b58c6682f79e51c756b401f5f0e96baa9957cee0991e3b5654196d0506efc1c4e39319d2f1
@@ -3,23 +3,25 @@ require 'etc'
3
3
  module Beachcomber
4
4
  # Discovers the Unix socket path for the beachcomber daemon.
5
5
  #
6
- # Discovery order:
7
- # 1. $XDG_RUNTIME_DIR/beachcomber/sock (if set and the path exists)
8
- # 2. $TMPDIR/beachcomber-<uid>/sock
6
+ # Mirrors the daemon's bind-path resolution (Config::resolve_socket_path),
7
+ # minus the config-file step which is daemon-only. Discovery order:
8
+ # 1. $BEACHCOMBER_SOCKET (if set and non-empty)
9
+ # 2. $XDG_RUNTIME_DIR/beachcomber/sock (if XDG_RUNTIME_DIR is set)
9
10
  # 3. /tmp/beachcomber-<uid>/sock
11
+ #
12
+ # There is no existence probe and $TMPDIR is not consulted: the result is the
13
+ # single path the daemon binds for the same environment. Non-standard setups
14
+ # point clients at the daemon via BEACHCOMBER_SOCKET.
10
15
  module Discovery
11
- # @return [String] the discovered or best-guess socket path
16
+ # @return [String] the resolved socket path
12
17
  def self.socket_path
18
+ sock = ENV['BEACHCOMBER_SOCKET']
19
+ return sock if sock && !sock.empty?
20
+
13
21
  xdg = ENV['XDG_RUNTIME_DIR']
14
- if xdg && !xdg.empty?
15
- candidate = File.join(xdg, 'beachcomber', 'sock')
16
- return candidate if File.exist?(candidate)
17
- end
22
+ return File.join(xdg, 'beachcomber', 'sock') if xdg && !xdg.empty?
18
23
 
19
- uid = Process.uid
20
- dir = "beachcomber-#{uid}"
21
- base = ENV.fetch('TMPDIR', nil) || '/tmp'
22
- File.join(base, dir, 'sock')
24
+ File.join('/tmp', "beachcomber-#{Process.uid}", 'sock')
23
25
  end
24
26
  end
25
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libbeachcomber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NavistAu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-28 00:00:00.000000000 Z
11
+ date: 2026-05-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Communicates with the beachcomber daemon over a Unix domain socket to
14
14
  query cached shell-environment data (git state, hostname, battery, etc.).