Top Level Namespace

Defined Under Namespace

Modules: Automerge

Constant Summary collapse

ROOT =
File.expand_path("../..", __dir__)

Instance Method Summary collapse

Instance Method Details

#command_output(*cmd) ⇒ Object



47
48
49
50
# File 'ext/automerge_ext/extconf.rb', line 47

def command_output(*cmd)
  stdout, _stderr, status = Open3.capture3(*cmd)
  status.success? ? stdout : ""
end

#have_cargo?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'ext/automerge_ext/extconf.rb', line 58

def have_cargo?
  command_output("cargo", "--version").start_with?("cargo")
end

#run!(*cmd) ⇒ Object



41
42
43
44
45
# File 'ext/automerge_ext/extconf.rb', line 41

def run!(*cmd)
  puts cmd.join(" ")
  ok = system(*cmd)
  abort "command failed: #{cmd.join(" ")}" unless ok
end

#rustc_minorObject



52
53
54
55
56
# File 'ext/automerge_ext/extconf.rb', line 52

def rustc_minor
  version = command_output("rustc", "--version")
  match = version.match(/rustc\s+(\d+)\.(\d+)/)
  match && [match[1].to_i, match[2].to_i]
end