Class: Kompo::CargoPath::Install

Inherits:
Taski::Task
  • Object
show all
Defined in:
lib/kompo/tasks/cargo_path.rb

Overview

Install Cargo via rustup and return the path

Instance Method Summary collapse

Instance Method Details

#runObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/kompo/tasks/cargo_path.rb', line 34

def run
  puts "Cargo not found. Installing via rustup..."
  system("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y")

  @path = File.expand_path("~/.cargo/bin/cargo")
  raise "Failed to install Cargo" unless File.executable?(@path)

  puts "Cargo installed at: #{@path}"
  version_output, = Open3.capture2e(@path, "--version")
  puts "Cargo version: #{version_output.chomp}"
end