Add `cargo binstall` metadata

Right now `cargo binstall` cannot find the pre-compiled `difftastic`
assets:

```
~
❯ cargo binstall difftastic
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? no
 WARN Installation cancelled

~ took 18s
❯ cargo binstall difftastic --pkg-url="{ repo }/releases/download/{ version }/difft-{ target }.{ archive-format }"
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 9.277840305s
```

Adding this `pkg-url` override to `Cargo.toml` allows `binstall` to find
the pre-compiled archives:

```
~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic
 INFO resolve: Resolving package: 'difftastic'
 INFO resolve: difftastic v0.38.0 is already installed, use --force to override
 INFO Done in 5.327886ms

~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic --force
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 5.484314255s
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
pull/431/head
Michel Alexandre Salim 2022-11-23 13:58:53 +07:00
parent 8e190677e7
commit 08041e5793
No known key found for this signature in database
GPG Key ID: 8B229D2F7CCC04F2
1 changed files with 6 additions and 0 deletions

@ -21,6 +21,12 @@ include = [
"/README.md",
]
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/{ version }/difft-{ target }.{ archive-format }"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
[dependencies]
regex = "1.5.4"
clap = { version = "3.1.8", features = ["cargo", "env", "wrap_help"] }