Class: Kompo::RubyBuildPath::FromHomebrew

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

Overview

Install ruby-build via Homebrew (macOS)

Instance Method Summary collapse

Instance Method Details

#runObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/kompo/tasks/ruby_build_path.rb', line 38

def run
  brew = HomebrewPath.path
  puts "Installing ruby-build via Homebrew..."
  system(brew, "install", "ruby-build") or raise "Failed to install ruby-build"

  prefix_output, = Open3.capture2(brew, "--prefix", "ruby-build", err: File::NULL)
  @path = prefix_output.chomp + "/bin/ruby-build"
  raise "Failed to install ruby-build" unless File.executable?(@path)

  puts "ruby-build path: #{@path}"
  version_output, = Open3.capture2(@path, "--version", err: File::NULL)
  puts "ruby-build version: #{version_output.chomp}"
end