Module: Bsdkrun::Binary
- Defined in:
- lib/bsdkrun/binary.rb
Overview
Locates the bsdkrun binary on the host and caches the result.
Resolution order (first match wins):
1. an explicit override set via {Bsdkrun.binary_path=}
2. the +BSDKRUN_BIN+ environment variable
3. +bsdkrun+ on +PATH+
4. an in-repo dev build: +<repo>/target/release/bsdkrun+ then +debug+
Class Attribute Summary collapse
-
.override ⇒ String?
The current explicit override, if any.
Class Method Summary collapse
-
.reset! ⇒ void
Reset cached discovery state (mainly for tests).
-
.resolve ⇒ String
Resolve (and cache) the path to the
bsdkrunbinary.
Class Attribute Details
.override ⇒ String?
Returns the current explicit override, if any.
28 29 30 |
# File 'lib/bsdkrun/binary.rb', line 28 def override @override end |
Class Method Details
.reset! ⇒ void
This method returns an undefined value.
Reset cached discovery state (mainly for tests).
32 33 34 35 |
# File 'lib/bsdkrun/binary.rb', line 32 def reset! @resolved = nil @override = nil end |
.resolve ⇒ String
Resolve (and cache) the path to the bsdkrun binary.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bsdkrun/binary.rb', line 41 def resolve return @resolved if @resolved searched = candidates searched.each do |candidate| if path_like?(candidate) return @resolved = candidate if File.exist?(candidate) else found = which(candidate) return @resolved = found if found end end raise BinaryNotFound, searched end |