Class: Gem::Ext::CargoBuilder
- Defined in:
- lib/rubygems/ext/cargo_builder.rb
Overview
This class is used by rubygems to build Rust extensions. It is a thin-wrapper over the `cargo rustc` command which takes care of building Rust code in a way that Ruby can use.
Defined Under Namespace
Classes: DylibNotFoundError
Instance Attribute Summary collapse
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Attributes inherited from Builder
Instance Method Summary collapse
- #build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd) ⇒ Object
-
#initialize(spec) ⇒ CargoBuilder
constructor
A new instance of CargoBuilder.
Methods inherited from Builder
#build_error, #build_extension, #build_extensions, #builder_for, class_name, make, run, #write_gem_make_out
Methods included from UserInteraction
#alert, #alert_error, #alert_warning, #ask, #ask_for_password, #ask_yes_no, #choose_from_list, #say, #terminate_interaction, #verbose
Methods included from DefaultUserInteraction
ui, #ui, ui=, #ui=, use_ui, #use_ui
Methods included from Text
#clean_text, #format_text, #levenshtein_distance, #min3, #truncate_text
Constructor Details
#initialize(spec) ⇒ CargoBuilder
Returns a new instance of CargoBuilder.
9 10 11 |
# File 'lib/rubygems/ext/cargo_builder.rb', line 9 def initialize(spec) @spec = spec end |
Instance Attribute Details
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
7 8 9 |
# File 'lib/rubygems/ext/cargo_builder.rb', line 7 def spec @spec end |
Instance Method Details
#build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubygems/ext/cargo_builder.rb', line 13 def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd) require "rubygems/command" require "fileutils" require "shellwords" build_crate(dest_path, results, args, cargo_dir) ext_path = rename_cdylib_for_ruby_compatibility(dest_path) finalize_directory(ext_path, dest_path, lib_dir, cargo_dir) results end |