From 3f7614b8855c849843965bec92ae9b8719e8b0c1 Mon Sep 17 00:00:00 2001 From: DottoDev <37108907+DottoDev@users.noreply.github.com> Date: Mon, 10 Oct 2022 20:16:13 +0000 Subject: [PATCH] feat: add support for bun (#7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authored-by: Matthieu Vion Approved-by: Thomas Schönauer --- src/config.rs | 1 + src/main.rs | 1 + src/steps/bun.rs | 0 src/steps/os/unix.rs | 8 ++++++++ 4 files changed, 10 insertions(+) create mode 100644 src/steps/bun.rs diff --git a/src/config.rs b/src/config.rs index d7c45696..79fc9c33 100644 --- a/src/config.rs +++ b/src/config.rs @@ -71,6 +71,7 @@ pub enum Step { Atom, BrewCask, BrewFormula, + Bun, Bin, Cargo, Chezmoi, diff --git a/src/main.rs b/src/main.rs index b1c29e28..1757cdaa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -196,6 +196,7 @@ fn run() -> Result<()> { runner.execute(Step::HomeManager, "home-manager", || unix::run_home_manager(run_type))?; runner.execute(Step::Asdf, "asdf", || unix::run_asdf(run_type))?; runner.execute(Step::Pkgin, "pkgin", || unix::run_pkgin(&ctx))?; + runner.execute(Step::Bun, "bun", || unix::run_bun(&ctx))?; } #[cfg(target_os = "dragonfly")] diff --git a/src/steps/bun.rs b/src/steps/bun.rs new file mode 100644 index 00000000..e69de29b diff --git a/src/steps/os/unix.rs b/src/steps/os/unix.rs index a6c1468a..377d9ae8 100644 --- a/src/steps/os/unix.rs +++ b/src/steps/os/unix.rs @@ -409,6 +409,14 @@ pub fn run_sdkman(base_dirs: &BaseDirs, cleanup: bool, run_type: RunType) -> Res Ok(()) } +pub fn run_bun(ctx: &ExecutionContext) -> Result<()> { + let bun = require("bun")?; + + print_separator("Bun"); + + ctx.run_type().execute(&bun).arg("upgrade").check_run() +} + pub fn reboot() { print!("Rebooting..."); Command::new("sudo").arg("reboot").spawn().unwrap().wait().unwrap();