Deprecate the brew cask step (fix #520) (#529)

This commit is contained in:
Roey Darwish Dror
2020-10-01 14:31:36 +03:00
committed by GitHub
parent 06369e6e4a
commit f5e6dc0fb3
3 changed files with 33 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
use crate::execution_context::ExecutionContext;
use crate::executor::{CommandExt, RunType};
use crate::executor::RunType;
use crate::terminal::{print_separator, prompt_yesno};
use crate::{
error::TopgradeError,
@@ -19,40 +19,6 @@ pub fn run_msupdate(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(msupdate).arg("--install").check_run()
}
pub fn run_brew_cask(ctx: &ExecutionContext) -> Result<()> {
let brew = require("brew")?;
print_separator("Brew Cask");
let config = ctx.config();
let run_type = ctx.run_type();
let cask_upgrade_exists = Command::new(&brew)
.args(&["--repository", "buo/cask-upgrade"])
.check_output()
.map(|p| Path::new(p.trim()).exists())?;
let cask_args = if cask_upgrade_exists {
let mut args = vec!["cu", "-y"];
if config.brew_cask_greedy() {
args.push("-a");
}
args
} else {
let mut args = vec!["upgrade", "--cask"];
if config.brew_cask_greedy() {
args.push("--greedy");
}
args
};
run_type.execute(&brew).args(&cask_args).check_run()?;
if ctx.config().cleanup() {
run_type.execute(&brew).arg("cleanup").check_run()?;
}
Ok(())
}
pub fn run_macports(ctx: &ExecutionContext) -> Result<()> {
require("port")?;
let sudo = ctx.sudo().as_ref().unwrap();