mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Rename GhRelease fetcher to GhCrateMeta
In preparation for have an e.g. GhDiscover which would auto-discover the package URL via the GitHub Releases API.
This commit is contained in:
parent
99e5de0025
commit
50ac8d0847
3 changed files with 6 additions and 6 deletions
|
@ -1,11 +1,11 @@
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub use gh_release::*;
|
pub use gh_crate_meta::*;
|
||||||
pub use quickinstall::*;
|
pub use quickinstall::*;
|
||||||
|
|
||||||
use crate::{PkgFmt, PkgMeta};
|
use crate::{PkgFmt, PkgMeta};
|
||||||
|
|
||||||
mod gh_release;
|
mod gh_crate_meta;
|
||||||
mod quickinstall;
|
mod quickinstall;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
|
|
|
@ -7,13 +7,13 @@ use serde::Serialize;
|
||||||
use super::Data;
|
use super::Data;
|
||||||
use crate::{download, remote_exists, PkgFmt, Template};
|
use crate::{download, remote_exists, PkgFmt, Template};
|
||||||
|
|
||||||
pub struct GhRelease {
|
pub struct GhCrateMeta {
|
||||||
url: String,
|
url: String,
|
||||||
pkg_fmt: PkgFmt,
|
pkg_fmt: PkgFmt,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl super::Fetcher for GhRelease {
|
impl super::Fetcher for GhCrateMeta {
|
||||||
async fn new(data: &Data) -> Result<Box<Self>, anyhow::Error> {
|
async fn new(data: &Data) -> Result<Box<Self>, anyhow::Error> {
|
||||||
// Generate context for URL interpolation
|
// Generate context for URL interpolation
|
||||||
let ctx = Context {
|
let ctx = Context {
|
|
@ -9,7 +9,7 @@ use tempdir::TempDir;
|
||||||
|
|
||||||
use cargo_binstall::{
|
use cargo_binstall::{
|
||||||
bins,
|
bins,
|
||||||
fetchers::{Data, Fetcher, GhRelease, MultiFetcher, QuickInstall},
|
fetchers::{Data, Fetcher, GhCrateMeta, MultiFetcher, QuickInstall},
|
||||||
*,
|
*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
|
|
||||||
// Try github releases, then quickinstall
|
// Try github releases, then quickinstall
|
||||||
let mut fetchers = MultiFetcher::default();
|
let mut fetchers = MultiFetcher::default();
|
||||||
fetchers.add(GhRelease::new(&fetcher_data).await?);
|
fetchers.add(GhCrateMeta::new(&fetcher_data).await?);
|
||||||
fetchers.add(QuickInstall::new(&fetcher_data).await?);
|
fetchers.add(QuickInstall::new(&fetcher_data).await?);
|
||||||
|
|
||||||
let fetcher = fetchers.first_available().await.ok_or_else(|| {
|
let fetcher = fetchers.first_available().await.ok_or_else(|| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue