Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Conda (fix #829)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-darwish committed Jan 14, 2022
1 parent b34cc1b commit 4e18b40
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub enum Step {
Chocolatey,
Choosenim,
Composer,
Conda,
CustomCommands,
Deno,
Dotnet,
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ fn run() -> Result<()> {
runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?;
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?;
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?;
runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?;
Expand Down
29 changes: 21 additions & 8 deletions src/steps/generic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#![allow(unused_imports)]

use std::path::PathBuf;
use std::process::Command;
use std::{env, path::Path};
use std::{fs, io::Write};

use anyhow::Result;
use directories::BaseDirs;
use log::debug;
use tempfile::tempfile_in;

use crate::execution_context::ExecutionContext;
use crate::executor::{CommandExt, ExecutorOutput, RunType};
use crate::terminal::{print_separator, shell};
Expand All @@ -7,14 +18,6 @@ use crate::{
error::{SkipStep, TopgradeError},
terminal::print_warning,
};
use anyhow::Result;
use directories::BaseDirs;
use log::debug;
use std::path::PathBuf;
use std::process::Command;
use std::{env, path::Path};
use std::{fs, io::Write};
use tempfile::tempfile_in;

pub fn run_cargo_update(ctx: &ExecutionContext) -> Result<()> {
let cargo_dir = env::var_os("CARGO_HOME")
Expand Down Expand Up @@ -226,6 +229,16 @@ pub fn run_pipx_update(run_type: RunType) -> Result<()> {
run_type.execute(&pipx).arg("upgrade-all").check_run()
}

pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
let conda = utils::require("conda")?;
print_separator("Conda");

ctx.run_type()
.execute(&conda)
.args(&["update", "--all", "-y"])
.check_run()
}

pub fn run_pip3_update(run_type: RunType) -> Result<()> {
let pip3 = utils::require("pip3")?;
print_separator("pip3");
Expand Down

0 comments on commit 4e18b40

Please sign in to comment.