mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-12 23:10:02 +00:00
swapped to symlink-based installation
This commit is contained in:
parent
8f7f7f5530
commit
8777c355c5
5 changed files with 217 additions and 72 deletions
30
src/lib.rs
30
src/lib.rs
|
@ -14,9 +14,12 @@ pub use drivers::*;
|
|||
/// Compiled target triple, used as default for binary fetching
|
||||
pub const TARGET: &'static str = env!("TARGET");
|
||||
|
||||
/// Default package path for use if no path is specified
|
||||
/// Default package path template (may be overridden in package Cargo.toml)
|
||||
pub const DEFAULT_PKG_PATH: &'static str = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.{ format }";
|
||||
|
||||
/// Default binary name template (may be overridden in package Cargo.toml)
|
||||
pub const DEFAULT_BIN_NAME: &'static str = "{ name }-{ target }-v{ version }";
|
||||
|
||||
|
||||
/// Binary format enumeration
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -39,14 +42,22 @@ pub enum PkgFmt {
|
|||
#[derive(Clone, Debug, StructOpt, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Meta {
|
||||
/// Path template override for binary downloads
|
||||
/// Path template override for package downloads
|
||||
pub pkg_url: Option<String>,
|
||||
/// Package name override for binary downloads
|
||||
pub pkg_name: Option<String>,
|
||||
/// Format override for binary downloads
|
||||
pub pkg_fmt: Option<PkgFmt>,
|
||||
}
|
||||
|
||||
/// Package name override for package downloads
|
||||
pub pkg_name: Option<String>,
|
||||
|
||||
/// Format override for package downloads
|
||||
pub pkg_fmt: Option<PkgFmt>,
|
||||
|
||||
#[serde(default)]
|
||||
/// Filters for binary files allowed in the package
|
||||
pub pkg_bins: Vec<String>,
|
||||
|
||||
/// Public key for package verification (base64 encoded)
|
||||
pub pkg_pub_key: Option<String>,
|
||||
}
|
||||
|
||||
/// Template for constructing download paths
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
|
@ -55,7 +66,7 @@ pub struct Context {
|
|||
pub repo: Option<String>,
|
||||
pub target: String,
|
||||
pub version: String,
|
||||
pub format: PkgFmt,
|
||||
pub format: String,
|
||||
}
|
||||
|
||||
impl Context {
|
||||
|
@ -72,4 +83,5 @@ impl Context {
|
|||
|
||||
Ok(rendered)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue