feat: add fetch_head configuration option into brew (#679)
This commit is contained in:
@@ -106,6 +106,9 @@
|
||||
# greedy_cask = true
|
||||
# autoremove = true
|
||||
|
||||
# Upgrade formulae built from the HEAD branch; `brew upgrade --fetch-HEAD`
|
||||
# fetch_head = true
|
||||
|
||||
|
||||
[linux]
|
||||
# Arch Package Manager to use.
|
||||
|
||||
@@ -254,6 +254,7 @@ pub struct Flatpak {
|
||||
pub struct Brew {
|
||||
greedy_cask: Option<bool>,
|
||||
autoremove: Option<bool>,
|
||||
fetch_head: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, Copy)]
|
||||
@@ -1096,6 +1097,15 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Whether Brew should upgrade formulae built from the HEAD branch
|
||||
pub fn brew_fetch_head(&self) -> bool {
|
||||
self.config_file
|
||||
.brew
|
||||
.as_ref()
|
||||
.and_then(|c| c.fetch_head)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Whether Composer should update itself
|
||||
pub fn composer_self_update(&self) -> bool {
|
||||
self.config_file
|
||||
|
||||
@@ -285,10 +285,15 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
|
||||
let run_type = ctx.run_type();
|
||||
|
||||
variant.execute(run_type).arg("update").status_checked()?;
|
||||
variant
|
||||
.execute(run_type)
|
||||
.args(["upgrade", "--formula"])
|
||||
.status_checked()?;
|
||||
|
||||
let mut command = variant.execute(run_type);
|
||||
command.args(["upgrade", "--formula"]);
|
||||
|
||||
if ctx.config().brew_fetch_head() {
|
||||
command.arg("--fetch-HEAD");
|
||||
}
|
||||
|
||||
command.status_checked()?;
|
||||
|
||||
if ctx.config().cleanup() {
|
||||
variant.execute(run_type).arg("cleanup").status_checked()?;
|
||||
|
||||
Reference in New Issue
Block a user