Class: SpaceArchitect::MiseClient

Inherits:
Object
  • Object
show all
Defined in:
lib/space_architect/mise_client.rb

Instance Method Summary collapse

Instance Method Details

#trust(path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/space_architect/mise_client.rb', line 9

def trust(path)
  path = Pathname.new(path)
  stdout, stderr, status = capture("mise", "trust", "--yes", "--quiet", "--cd", path.to_s)
  return true if status.success?

  output = [stdout, stderr].reject(&:empty?).join("\n").strip
  message = "mise trust failed for #{path}"
  message = "#{message}: #{output}" unless output.empty?
  raise MiseError, message
rescue Errno::ENOENT
  raise MiseError, "mise executable not found; install mise or make sure it is on PATH"
end