Home

Awesome

Thermite

Linux/OSX build status Windows build status Code Climate Test coverage Inline docs Gem

Thermite is a Rake-based helper for building and distributing Rust-based Ruby extensions.

Features

Usage

  1. Add the following to your gemspec file:
spec.extensions << 'ext/Rakefile'
spec.add_runtime_dependency 'thermite', '~> 0'
  1. Create ext/Rakefile with the following code, assuming that the Cargo project root is the same as the Ruby project root:
require 'thermite/tasks'

project_dir = File.dirname(File.dirname(__FILE__))
Thermite::Tasks.new(cargo_project_path: project_dir, ruby_project_path: project_dir)
task default: %w(thermite:build)
  1. In Rakefile, integrate Thermite into your build-test workflow:
require 'thermite/tasks'

Thermite::Tasks.new

desc 'Run Rust & Ruby testsuites'
task test: ['thermite:build', 'thermite:test'] do
  # …
end

Run rake -T thermite to view all of the available tasks in the thermite namespace.

Configuration

Task configuration for your project can be set in two ways:

[package.metadata.thermite]

github_releases = true

Possible options:

Example

Using the cliché Rust+Ruby example, the rusty_blank repository contains an example of using Thermite with ruru to provide a String.blank? speedup extension. While the example uses ruru, this gem should be usable with any method of integrating Rust and Ruby that you choose.

Debug / release build

By default Thermite will do a release build of your Rust code. To do a debug build instead, set the CARGO_PROFILE environment variable to debug.

For example, you can run CARGO_PROFILE=debug rake thermite:build.

Troubleshooting

Debug statements can be written to a file specified by the THERMITE_DEBUG_FILENAME environment variable.

FAQ

Why is it named Thermite?

According to Wikipedia:

Release Notes

Contributing

Legal

This gem is licensed under the MIT license.