The tool for the developer to help them create mruby applications on the WebAssembly.
Add this line to your application's Gemfile:
gem 'mwc'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mwc
- Curl
- Tar
- Emscripten SDK
- Ruby 2.6+
Please make sure you can execute
emcc
before usemwc compile
Execute below command with your project name:
$ mwc init my_mrb
This gem will create a directory my_mrb
with anything you need to play with mruby on WebAssembly.
src/**/*.c
the normal C codesrc/js/**/*.lib.js
the JavaScript library can be called in Csrc/js/**/*.pre.js
the JavaScript prepend to WebAssembly JSsrc/js/**/*.post.js
the JavaScript append to WebAssembly JS
To compile *.c
to .wasm
you have to execute compile
command:
$ mwc compile
You can specify compile environment to change with different options:
$ mwc compile --env=dev
To see more usage with help
command:
$ mwc help compile
The mwc
has built-in static file server to help preview or debug:
$ mwc server
And then, open the http://localhost:8080
you will see the Emscripten web shell and Hello World
is printed.
We use DSL to define the compile preferences in .mwcrc
project.name = 'mruby'
mruby.version = '2.1.3'
env :dev do
project.source_map = true
end
Name | Type | Description |
---|---|---|
name | string | The project name, will change the generated file name. ex. mruby.wasm |
shell | string | The shell file template, if you want to use your own html template |
source_map | boolean | Enable source map for debug |
options | array | Extra compile options. ex. -s ALLOW_MEMORY_GROWTH=1 |
Name | Type | Description |
---|---|---|
version | string | The prefer mruby version |
- Unit Test
- Download options for mruby
- Archive
- Git Submodule
- Integrate to Webpack
- Watch Mode
- Auto re-compile
- Add LiveReload support
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/elct9620/mwc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Mwc project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.