Class: Kompo::KompoVfsPath::FromSource

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

Overview

Build from source (requires Cargo)

Constant Summary collapse

REPO_URL =
"https://github.com/ahogappa/kompo-vfs"

Instance Method Summary collapse

Instance Method Details

#runObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/kompo/tasks/kompo_vfs_path.rb', line 109

def run
  puts "Building kompo-vfs from source..."
  cargo = CargoPath.path

  build_dir = File.expand_path("~/.kompo/kompo-vfs")
  FileUtils.mkdir_p(File.dirname(build_dir))

  if Dir.exist?(build_dir)
    system("git", "-C", build_dir, "pull", "--quiet")
  else
    system("git", "clone", REPO_URL, build_dir) or raise "Failed to clone kompo-vfs repository"
  end

  system(cargo, "build", "--release", chdir: build_dir) or raise "Failed to build kompo-vfs"

  @path = File.join(build_dir, "target", "release")
  puts "kompo-vfs library path: #{@path}"

  KompoVfsVersionCheck.verify!(@path)
end