Module: Space::Architect::SessionSync::BinPath

Defined in:
lib/space_architect/session_sync/bin_path.rb

Overview

Resolves the absolute path to the architect executable the plist should invoke, imitating Space::Src::CLI::Daemon::Helpers::Resolve's detect_bin_path precedence: an env override (tests), the dev checkout's exe/architect, which architect, then the installed gem's bin.

Class Method Summary collapse

Class Method Details

.detect(env: ENV) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/space_architect/session_sync/bin_path.rb', line 14

def detect(env: ENV)
  override = env["SPACE_ARCHITECT_BIN_PATH"]
  return override if override && !override.empty?

  dev = File.expand_path("../../../exe/architect", __dir__)
  return dev if File.exist?(dev)

  out, _err, status = Open3.capture3("which", "architect")
  return out.strip if status.success? && !out.strip.empty?

  Gem.bin_path("space-architect", "architect")
end