Split brew cask to a seperated step

This commit is contained in:
Roey Darwish Dror
2020-07-02 08:37:18 +03:00
parent 6300d6fb2a
commit 3d4917fa88
2 changed files with 12 additions and 4 deletions

View File

@@ -159,7 +159,8 @@ fn run() -> Result<()> {
#[cfg(unix)] #[cfg(unix)]
{ {
if config.should_run(Step::Brew) { if config.should_run(Step::Brew) {
runner.execute("brew", || unix::run_homebrew(&ctx))?; runner.execute("Brew", || unix::run_brew(&ctx))?;
runner.execute("Brew Cask", || unix::run_brew_cask(&ctx))?;
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {

View File

@@ -30,17 +30,24 @@ pub fn run_fisher(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
run_type.execute(&fish).args(&["-c", "fisher"]).check_run() run_type.execute(&fish).args(&["-c", "fisher"]).check_run()
} }
pub fn run_homebrew(ctx: &ExecutionContext) -> Result<()> { pub fn run_brew(ctx: &ExecutionContext) -> Result<()> {
let brew = require("brew")?; let brew = require("brew")?;
print_separator("Brew"); print_separator("Brew");
let run_type = ctx.run_type(); let run_type = ctx.run_type();
let config = ctx.config();
run_type.execute(&brew).arg("update").check_run()?; run_type.execute(&brew).arg("update").check_run()?;
run_type run_type
.execute(&brew) .execute(&brew)
.args(&["upgrade", "--ignore-pinned"]) .args(&["upgrade", "--ignore-pinned"])
.check_run()?; .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) let cask_upgrade_exists = Command::new(&brew)
.args(&["--repository", "buo/cask-upgrade"]) .args(&["--repository", "buo/cask-upgrade"])