Skip to content
🚆 Experiments to embed Ruby on Rails in Rust with mruby
Rust Ruby Other
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Work around bug in gh-pages 2.1.0 Aug 1, 2019
.idea Addressing feedback May 18, 2019
foolsgold yarn lint Jul 8, 2019
guide rename from lopopolo/ferrocarril -> artichoke/ferrocarril Jul 27, 2019
hubris
mruby-bin Get rid of Interpreter struct Jul 4, 2019
mruby-gems Upgrade rust-embed to 4.5.0 Jul 4, 2019
mruby-sys Upgrade mruby Jul 10, 2019
mruby-vfs
mruby rename from lopopolo/ferrocarril -> artichoke/ferrocarril Jul 27, 2019
nemesis rename from lopopolo/ferrocarril -> artichoke/ferrocarril Jul 27, 2019
scripts Fix --check mode of format-text.sh to fail builds if there are errors Aug 1, 2019
spec-runner Allow ruby-spec to run to completion for core Jul 10, 2019
.eslintignore Add eslint ignore Aug 1, 2019
.gitattributes [skip ci] mark spec-runner/spec as vendored Jun 24, 2019
.gitignore
.prettierignore add prettier ignore Aug 1, 2019
.ruby-version Bump ruby version May 28, 2019
Cargo.lock Remove cactusref Jul 27, 2019
Cargo.toml Remove cactusref Jul 27, 2019
LICENSE Initial commit Apr 7, 2019
README.md rename from lopopolo/ferrocarril -> artichoke/ferrocarril Jul 27, 2019
package.json Since we have to pass --git, we depend on gh-pages@^2.1.0 Aug 1, 2019
rust-toolchain Bump rust toolchain to 1.38.0-nightly 2019-07-07 Jul 8, 2019
yarn.lock Since we have to pass --git, we depend on gh-pages@^2.1.0 Aug 1, 2019

README.md

ferrocarril

CircleCI

ferrocarril aims to embed a Ruby on Rails web application that talks to an external MySQL database in Rust and serve the app with Rocket.

ferrocarril means railway in Spanish and sounds like ferrous which means containing iron.

hubris

The hubris crate runs a Sinatra::Base echo server with Nemesis.

Usage

HUBRIS_LOG=info cargo run --bin hubris

Then, open http://localhost:8000 on your browser.

Features

  • Utilizes a Rust implenentation of Regexp and MatchData.
  • Utilizes a stack-based synchronous implementation of Thread.
  • Utilizes a complete implementation of Ruby 2.6.3 String API that uses a hybrid of mruby C, Ruby, and Rust.
  • Utilizes implementations of Ruby standard library packages customized for mruby, including delegate, forwardable, json, monitor, ostruct, set, strscan, and uri.
  • Utilizes patched versions of Sinatra and its dependencies.

foolsgold

The foolsgold crate is an early attempt to achieve the goal of a Rust-backed Ruby web application.

Usage

FOOLSGOLD_LOG=info cargo run --bin foolsgold

Then, open http://localhost:8000 on your browser.

Features

REPL

Crate mruby-bin provides an rirb executable that is an IRB shell and REPL for the mruby interpreter in this workspace. rirb aims to load every extension to mruby made by this workspace in addition to all gems in the gems crate.

Usage

cargo run --bin rirb

Contributing

There is a lot to build! If you'd like to help out, take a look at the open issues. Tickets that are tagged with good first issue might be a good introduction to the codebase.

Setup

A ferrocarril development environment has several dependencies. Setup your development environment.

Code Overview

To familiarize yourself with the code in this workspace, consider reviewing these source files:

File Purpose Learning Objective
manual.rs mruby crate integration test Define Rust-backed Ruby sources
extn::regexp Regexp implementation Implement a Ruby Core class with a mix of Rust and Ruby
nemesis.rs nemesis crate Ruby runtime Define a Gem
ffi_tests.rs C API test suite Manipulate an interpreter with the C API
repl.rs REPL loop for rirb Eval code on an interpreter and handle errors

Known Missing Features

Core

mruby does not implement all Ruby 2.6 core classes.

Required classes include (at least):

  • File
  • IO
  • Regexp

Standard Library

mruby does not implement any of the Ruby 2.6 standard library.

See the stdlib tracking ticket (GH-8) for more details.

Gems

Rails requires lots of gems. This workspace maintains a registry of vendored gems. To support the goal of running Rails, this crate identifies dependencies, vendors the gem sources, patches gems so they parse on mruby, reimplements C extensions in Rust, and runs the tests for each gem.

You can’t perform that action at this time.