{"id":16237849,"url":"https://github.com/malept/thermite","last_synced_at":"2025-04-05T16:08:22.366Z","repository":{"id":52671019,"uuid":"61381365","full_name":"malept/thermite","owner":"malept","description":"A Rake-based helper for building and distributing Rust-based Ruby extensions","archived":false,"fork":false,"pushed_at":"2021-04-21T16:03:58.000Z","size":171,"stargazers_count":139,"open_issues_count":15,"forks_count":11,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-24T16:08:54.337Z","etag":null,"topics":["cargo","rake","ruby","rust"],"latest_commit_sha":null,"homepage":"http://www.rubydoc.info/github/malept/thermite","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/malept.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-17T14:53:13.000Z","updated_at":"2024-07-15T00:38:53.000Z","dependencies_parsed_at":"2022-08-21T11:50:07.143Z","dependency_job_id":null,"html_url":"https://github.com/malept/thermite","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malept%2Fthermite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malept%2Fthermite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malept%2Fthermite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malept%2Fthermite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malept","download_url":"https://codeload.github.com/malept/thermite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361691,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","rake","ruby","rust"],"created_at":"2024-10-10T13:37:42.871Z","updated_at":"2025-04-05T16:08:22.345Z","avatar_url":"https://github.com/malept.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thermite\n\n[![Linux/OSX build status](https://travis-ci.org/malept/thermite.svg?branch=master)](https://travis-ci.org/malept/thermite)\n[![Windows build status](https://ci.appveyor.com/api/projects/status/kneo890m3ypoxril?svg=true)](https://ci.appveyor.com/project/malept/thermite)\n[![Code Climate](https://codeclimate.com/github/malept/thermite/badges/gpa.svg)](https://codeclimate.com/github/malept/thermite)\n[![Test coverage](https://codeclimate.com/github/malept/thermite/badges/coverage.svg)](https://codeclimate.com/github/malept/thermite/coverage)\n[![Inline docs](http://inch-ci.org/github/malept/thermite.svg?branch=master)](http://inch-ci.org/github/malept/thermite)\n[![Gem](https://img.shields.io/gem/v/thermite.svg?maxAge=30000)](https://rubygems.org/gems/thermite)\n\nThermite is a Rake-based helper for building and distributing Rust-based Ruby extensions.\n\n## Features\n\n* Provides wrappers for `cargo` commands.\n* Handles non-standard `cargo` installations via the `CARGO` environment variable.\n* Opt-in to allow users to install pre-compiled Rust extensions hosted on GitHub releases.\n* Opt-in to allow users to install pre-compiled Rust extensions hosted on a third party server.\n* Provides a wrapper for initializing a Rust extension via Fiddle.\n\n## Usage\n\n1. Add the following to your gemspec file:\n\n  ```ruby\n  spec.extensions \u003c\u003c 'ext/Rakefile'\n  spec.add_runtime_dependency 'thermite', '~\u003e 0'\n  ```\n\n2. Create `ext/Rakefile` with the following code, assuming that the Cargo project root is the same\n   as the Ruby project root:\n\n  ```ruby\n  require 'thermite/tasks'\n\n  project_dir = File.dirname(File.dirname(__FILE__))\n  Thermite::Tasks.new(cargo_project_path: project_dir, ruby_project_path: project_dir)\n  task default: %w(thermite:build)\n  ```\n\n3. In `Rakefile`, integrate Thermite into your build-test workflow:\n\n  ```ruby\n  require 'thermite/tasks'\n\n  Thermite::Tasks.new\n\n  desc 'Run Rust \u0026 Ruby testsuites'\n  task test: ['thermite:build', 'thermite:test'] do\n    # …\n  end\n  ```\n\nRun `rake -T thermite` to view all of the available tasks in the `thermite` namespace.\n\n### Configuration\n\nTask configuration for your project can be set in two ways:\n\n* passing arguments to `Thermite::Tasks.new`\n* adding a `package.metadata.thermite` section to `Cargo.toml`. These settings override the\n  arguments passed to the `Tasks` class. Due to the conflict, it is infeasible for\n  `cargo_project_path` or `cargo_workspace_member` to be set in this way. Example section:\n\n```toml\n[package.metadata.thermite]\n\ngithub_releases = true\n```\n\nPossible options:\n\n* `binary_uri_format` - if set, the interpolation-formatted string used to construct the download\n  URI for the pre-built native extension. If the environment variable `THERMITE_BINARY_URI_FORMAT`\n  is set, it takes precedence over this option. Either method of setting this option overrides the\n  `github_releases` option.\n  Example: `https://example.com/download/%{version}/%{filename}`. Replacement variables:\n    - `filename` - The value of `Config.tarball_filename`\n    - `version` - the crate version from `Cargo.toml`\n* `cargo_project_path` - the path to the top-level Cargo project. Defaults to the current working\n  directory.\n* `cargo_workspace_member` - if set, the relative path to the Cargo workspace member. Usually used\n  when it is part of a repository containing multiple crates.\n* `github_releases` - whether to look for Rust binaries via GitHub releases when installing\n  the gem, and `cargo` is not found. Defaults to `false`.\n* `github_release_type` - when `github_releases` is `true`, the mode to use to download the Rust\n  binary from GitHub releases. `'cargo'` (the default) uses the version in `Cargo.toml`, along with\n  the `git_tag_format` option (described below) to determine the download URI. `'latest'` takes the\n  latest release matching the `git_tag_regex` option (described below) to determine the download\n  URI.\n* `git_tag_format` - when `github_release_type` is `'cargo'` (the default), the\n  [format string](http://ruby-doc.org/core/String.html#method-i-25) used to determine the tag used\n  in the GitHub download URI. Defaults to `v%s`, where `%s` is the version in `Cargo.toml`.\n* `git_tag_regex` - when `github_releases` is enabled and `github_release_type` is `'latest'`, a\n  regular expression (expressed as a `String`) that determines which tagged releases to look for\n  precompiled Rust tarballs. One group must be specified that indicates the version number to be\n  used in the tarball filename. Defaults to the [semantic versioning 2.0.0\n  format](https://semver.org/spec/v2.0.0.html). In this case, the group is around the entire\n  expression.\n* `optional_rust_extension` - prints a warning to STDERR instead of raising an exception, if Cargo\n  is unavailable and `github_releases` is either disabled or unavailable. Useful for projects where\n  either fallback code exists, or a native extension is desirable but not required. Defaults\n  to `false`.\n* `ruby_project_path` - the top-level directory of the Ruby gem's project. Defaults to the\n  current working directory.\n* `ruby_extension_dir` - the directory relative to `ruby_project_path` where the extension is\n  located. Defaults to `lib`.\n\n### Example\n\nUsing the cliché Rust+Ruby example, the [`rusty_blank`](https://github.com/malept/rusty_blank)\nrepository contains an example of using Thermite with [ruru](https://github.com/d-unseductable/ruru)\nto provide a `String.blank?` speedup extension. While the example uses ruru, this gem should be\nusable with any method of integrating Rust and Ruby that you choose.\n\n### Debug / release build\n\nBy default Thermite will do a release build of your Rust code. To do a debug build instead,\nset the `CARGO_PROFILE` environment variable to `debug`.\n\nFor example, you can run `CARGO_PROFILE=debug rake thermite:build`.\n\n### Troubleshooting\n\nDebug statements can be written to a file specified by the `THERMITE_DEBUG_FILENAME` environment\nvariable.\n\n## FAQ\n\n### Why is it named Thermite?\n\nAccording to Wikipedia:\n\n* The chemical formula for ruby includes Al\u003csub\u003e2\u003c/sub\u003eO\u003csub\u003e3\u003c/sub\u003e, or aluminum oxide.\n* Rust is iron oxide, or Fe\u003csub\u003e2\u003c/sub\u003eO\u003csub\u003e3\u003c/sub\u003e.\n* A common thermite reaction uses iron oxide and aluminum to produce iron and aluminum oxide:\n  Fe\u003csub\u003e2\u003c/sub\u003eO\u003csub\u003e3\u003c/sub\u003e + 2Al → 2Fe + Al\u003csub\u003e2\u003c/sub\u003eO\u003csub\u003e3\u003c/sub\u003e\n\n## [Release Notes](https://github.com/malept/thermite/blob/master/NEWS.md)\n\n## [Contributing](https://github.com/malept/thermite/blob/master/CONTRIBUTING.md)\n\n## Legal\n\nThis gem is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalept%2Fthermite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalept%2Fthermite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalept%2Fthermite/lists"}