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