Class: RubyWasm::WitBindgen
- Inherits:
-
Object
- Object
- RubyWasm::WitBindgen
- Defined in:
- lib/ruby_wasm/build/toolchain/wit_bindgen.rb
Instance Attribute Summary collapse
-
#bin_path ⇒ Object
readonly
Returns the value of attribute bin_path.
Instance Method Summary collapse
-
#initialize(build_dir:, revision: "67e17745a417d07852cc283d1399d210d4d659cc") ⇒ WitBindgen
constructor
A new instance of WitBindgen.
- #install ⇒ Object
Constructor Details
#initialize(build_dir:, revision: "67e17745a417d07852cc283d1399d210d4d659cc") ⇒ WitBindgen
Returns a new instance of WitBindgen.
5 6 7 8 9 10 11 12 13 |
# File 'lib/ruby_wasm/build/toolchain/wit_bindgen.rb', line 5 def initialize( build_dir:, revision: "67e17745a417d07852cc283d1399d210d4d659cc" ) @build_dir = build_dir @tool_dir = File.join(@build_dir, "toolchain", "wit-bindgen-#{revision}") @bin_path = File.join(@tool_dir, "bin", "wit-bindgen") @revision = revision end |
Instance Attribute Details
#bin_path ⇒ Object (readonly)
Returns the value of attribute bin_path.
3 4 5 |
# File 'lib/ruby_wasm/build/toolchain/wit_bindgen.rb', line 3 def bin_path @bin_path end |
Instance Method Details
#install ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_wasm/build/toolchain/wit_bindgen.rb', line 15 def install return if File.exist?(@bin_path) RubyWasm::Toolchain.check_executable("cargo") Kernel.system( "cargo", "install", "--git", "https://github.com/bytecodealliance/wit-bindgen", "--rev", @revision, "--root", @tool_dir, "wit-bindgen-cli" ) end |