Split package managers to different steps (#447)
This commit is contained in:
committed by
GitHub
parent
a9e529eb79
commit
28c4c743ea
@@ -61,7 +61,6 @@ type Commands = BTreeMap<String, String>;
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum Step {
|
||||
System,
|
||||
PackageManagers,
|
||||
GitRepos,
|
||||
Vim,
|
||||
Emacs,
|
||||
@@ -90,6 +89,17 @@ pub enum Step {
|
||||
Wsl,
|
||||
Tmux,
|
||||
Vagrant,
|
||||
MicrosoftAutoUpdate,
|
||||
Brew,
|
||||
MacPorts,
|
||||
Nix,
|
||||
HomeManager,
|
||||
Asdf,
|
||||
Chocolatey,
|
||||
Scoop,
|
||||
Flatpak,
|
||||
Snap,
|
||||
Pkg,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
|
||||
31
src/main.rs
31
src/main.rs
@@ -133,30 +133,45 @@ fn run() -> Result<()> {
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if config.should_run(Step::PackageManagers) {
|
||||
if config.should_run(Step::Chocolatey) {
|
||||
runner.execute("Chocolatey", || windows::run_chocolatey(run_type))?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Scoop) {
|
||||
runner.execute("Scoop", || windows::run_scoop(config.cleanup(), run_type))?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
if config.should_run(Step::PackageManagers) {
|
||||
#[cfg(target_os = "macos")]
|
||||
runner.execute("Microsoft AutoUpdate", || macos::run_msupdate(&ctx))?;
|
||||
if config.should_run(Step::Brew) {
|
||||
runner.execute("brew", || unix::run_homebrew(&ctx))?;
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
if config.should_run(Step::MacPorts) {
|
||||
runner.execute("MacPorts", || macos::run_macports(&ctx))?;
|
||||
}
|
||||
if config.should_run(Step::MicrosoftAutoUpdate) {
|
||||
runner.execute("Microsoft AutoUpdate", || macos::run_msupdate(&ctx))?;
|
||||
}
|
||||
}
|
||||
if config.should_run(Step::Nix) {
|
||||
runner.execute("nix", || unix::run_nix(&ctx))?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::HomeManager) {
|
||||
runner.execute("home-manager", || unix::run_home_manager(run_type))?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Asdf) {
|
||||
runner.execute("asdf", || unix::run_asdf(run_type))?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
{
|
||||
if config.should_run(Step::PackageManagers) {
|
||||
if config.should_run(Step::Pkg) {
|
||||
runner.execute("DragonFly BSD Packages", || {
|
||||
dragonfly::upgrade_packages(sudo.as_ref(), run_type)
|
||||
})?;
|
||||
@@ -165,7 +180,7 @@ fn run() -> Result<()> {
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
{
|
||||
if config.should_run(Step::PackageManagers) {
|
||||
if config.should_run(Step::Pkg) {
|
||||
runner.execute("FreeBSD Packages", || {
|
||||
freebsd::upgrade_packages(sudo.as_ref(), run_type)
|
||||
})?;
|
||||
@@ -335,8 +350,10 @@ fn run() -> Result<()> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if config.should_run(Step::PackageManagers) {
|
||||
if config.should_run(Step::Flatpak) {
|
||||
runner.execute("Flatpak", || linux::flatpak_update(run_type))?;
|
||||
}
|
||||
if config.should_run(Step::Snap) {
|
||||
runner.execute("snap", || linux::run_snap(sudo.as_ref(), run_type))?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user