Module: Thermite::CustomBinary

Included in:
Tasks
Defined in:
lib/thermite/custom_binary.rb

Overview

Custom binary URI helpers.

Instance Method Summary collapse

Instance Method Details

#download_binary_from_custom_uriObject

Downloads a Rust binary using a custom URI format, given the target OS and architecture.

Requires the binary_uri_format option to be set. The version of the binary is determined by the crate version given in Cargo.toml.

Returns whether a binary was found and unpacked.


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/thermite/custom_binary.rb', line 36

def download_binary_from_custom_uri
  return false unless config.binary_uri_format

  version = config.crate_version
  uri ||= format(
    config.binary_uri_format,
    filename: config.tarball_filename(version),
    version: version
  )

  return false unless (tgz = download_versioned_binary(uri, version))

  debug "Unpacking binary from Cargo version: #{File.basename(uri)}"
  unpack_tarball(tgz)
  prepare_downloaded_library
  true
end