This project is no longer maintained
Ruvy aims to initialize the ruby VM using wizer and execute ruby code passed into the wasm.
rustup target add wasm32-wasip1homebrew via brew install cmakesoftwareupdate --install-rosettacargo install wasmtime-cliThe following environment variables allow you to experiment with different WASI SDKs:
RUVY_WASM_SYS_WASI_SDK_MAJOR_VERSION sets the major version of the WASI SDK to useRUVY_WASM_SYS_WASI_SDK_MINOR_VERSION sets the minor version of the WASI SDK to useRUVY_WASM_SYS_WASI_SDK_PATH allows you to specify a path to WASI SDK to useSet the RUVY_WASM_SYS_RUBY_PATH environment variable to a path containing an extracted release asset from https://github.com/ruby/ruby.wasm. The directory the environment variable is set to must contain an include and lib directory.
After all the dependencies are installed, run make
A simple ruby program that prints "Hello world" to stdout
$ cargo run --package=cli ruby_examples/hello_world.rb
$ wasmtime index.wasm
Hello world
You can preload files by pointing to a directory of ruby files. At the moment, it just naively loads each file 1 by 1.
$ cargo run --package=cli -- --preload=prelude/ ruby_examples/use_preludes_and_stdin.rb
$ echo "this is my input" | wasmtime index.wasm
{:discount_input=>"this is my input", :value=>100.0}
Here are some ideas for welcome contributions!
Ruvy is not currently compatible with Shopify Functions. This is due to the size of the Wasm modules produced by Ruvy exceeding the maximum size of Wasm modules supported by Shopify Functions.
Here are some ideas for how to make Ruvy compatible with Shopify Functions:
require and Ruby gems. At the present time, using code in the preload directory is the only way to add dependencies and large parts of the standard library are not available. It should be possible to enable require to work and to load both code from the standard library and from third party gems that are not native gems. A good example of showing this is fixed would be adding a Ruby example that uses the standard library's json library to parse and dump JSON.Rust
92.8%
Makefile
3.6%
Ruby
2.5%
C
1.1%
This project is no longer maintained
Ruvy aims to initialize the ruby VM using wizer and execute ruby code passed into the wasm.
rustup target add wasm32-wasip1homebrew via brew install cmakesoftwareupdate --install-rosettacargo install wasmtime-cliThe following environment variables allow you to experiment with different WASI SDKs:
RUVY_WASM_SYS_WASI_SDK_MAJOR_VERSION sets the major version of the WASI SDK to useRUVY_WASM_SYS_WASI_SDK_MINOR_VERSION sets the minor version of the WASI SDK to useRUVY_WASM_SYS_WASI_SDK_PATH allows you to specify a path to WASI SDK to useSet the RUVY_WASM_SYS_RUBY_PATH environment variable to a path containing an extracted release asset from https://github.com/ruby/ruby.wasm. The directory the environment variable is set to must contain an include and lib directory.
After all the dependencies are installed, run make
A simple ruby program that prints "Hello world" to stdout
$ cargo run --package=cli ruby_examples/hello_world.rb
$ wasmtime index.wasm
Hello world
You can preload files by pointing to a directory of ruby files. At the moment, it just naively loads each file 1 by 1.
$ cargo run --package=cli -- --preload=prelude/ ruby_examples/use_preludes_and_stdin.rb
$ echo "this is my input" | wasmtime index.wasm
{:discount_input=>"this is my input", :value=>100.0}
Here are some ideas for welcome contributions!
Ruvy is not currently compatible with Shopify Functions. This is due to the size of the Wasm modules produced by Ruvy exceeding the maximum size of Wasm modules supported by Shopify Functions.
Here are some ideas for how to make Ruvy compatible with Shopify Functions:
require and Ruby gems. At the present time, using code in the preload directory is the only way to add dependencies and large parts of the standard library are not available. It should be possible to enable require to work and to load both code from the standard library and from third party gems that are not native gems. A good example of showing this is fixed would be adding a Ruby example that uses the standard library's json library to parse and dump JSON.Rust
92.8%
Makefile
3.6%
Ruby
2.5%
C
1.1%