rustwrap

Crates.iorustwrap
lib.rsrustwrap
version1.0.5
sourcesrc
created_at2022-12-12 19:15:24.571508
updated_at2023-03-07 13:07:49.858046
descriptionA tool that helps wrap binary releases for easy distribution
homepage
repositoryhttps://github.com/rusty-ferris-club/rustwrap
max_upload_size
id735169
size100,032
Dotan J. Nahum (jondot)

documentation

https://docs.rs/rustwrap/

README


Rustwrap

A tool that helps wrap binary releases for easy distribution. Currently supporting:

  • npm - npm install -g your-tool will make your binary your-tool available via the CLI. rustwrap creates the necessary binary packages and root package with a Node.js shim that delegates running to your platform-specific bin.

  • Homebrew - creates a recipe and saves or publishes it to your tap.

Download

For macOS:

brew tap rusty-ferris-club/tap && brew install rustwrap

Through cargo:

cargo install rustwrap

Or cargo-binstall for installing binaries (save compilation time):

cargo binstall rustwrap

Otherwise, grab a release from releases and run rustwrap --help:

Getting started

Build a single rustwrap.yaml, and describe which releases you have an where to get them per platform, and your provider blocks.

Use __VERSION__ when you want the actual version replaced.

targets:
  - platform: win32
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-windows.zip
  - platform: linux
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-linux.tar.xz
  - platform: darwin
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-macos.tar.xz
  - platform: darwin
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-aarch64-macos.tar.xz

# provider: npm
# both recon-root.json and recon-sub.json paths are relative to working folder
npm:
  publish: false # dont publish to npm, just generate the packages on disk
  org: "@recontools"
  name: recon
  root: 
    name: recon-tool
    manifest: rustwrap/fixtures/config/recon-root.json
    readme: rustwrap/fixtures/config/README.md
  sub: 
    manifest: rustwrap/fixtures/config/recon-sub.json
    readme: rustwrap/fixtures/config/README.md

# provider: homebrew
brew:
  name: recon
  publish: true # push an update commit to the tap repo
  tap: jondot/homebrew-tap
  recipe_fname: recon.rb
  recipe_template: |
    class Recon < Formula
      desc "recon"
      homepage "http://www.example.com"
      url "__URL__"
      version "__VERSION__"
      sha256 "__SHA__"

      def install
        bin.install "recon"
      end
    end

With your rustwrap.yaml and relevant files in the current working folder, run:

$ rustwrap --tag 0.6.0

The --tag value replaces the __VERSION__ value.

About

This tool was inspired in part by the Rome toolchain and infrastructure built for releasing Rome on npm.

I gave it some generic abilities (downloading releases independently) and tweaks, and extended it with a Homebrew provider, something which I needed for a while now.

  • It can be used for any self-contained binary produced in any language, not just Rust
  • Accepting PRs for more providers

Contributing

We are accepting PRs. Feel free to submit PRs.

To all Contributors - you make this happen, thanks!

License

Copyright (c) 2022 @jondot. See LICENSE for further details.

Commit count: 28

cargo fmt