Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb51be0732 | ||
|
|
56a717dcc6 | ||
|
|
ee353ccb66 | ||
|
|
33cea0e5b6 | ||
|
|
78a491a976 | ||
|
|
9553be04e4 | ||
|
|
81928f55a2 | ||
|
|
4e56bf07f3 | ||
|
|
9f424f03c3 | ||
|
|
1e14b3bf28 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2055,7 +2055,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "topgrade"
|
||||
version = "10.2.2"
|
||||
version = "10.2.3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"chrono",
|
||||
|
||||
@@ -6,7 +6,7 @@ keywords = ["upgrade", "update"]
|
||||
license = "GPL-3.0"
|
||||
# license-file = "LICENSE"
|
||||
repository = "https://github.com/topgrade-rs/topgrade"
|
||||
version = "10.2.2"
|
||||
version = "10.2.3"
|
||||
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"]
|
||||
exclude = ["doc/screenshot.gif"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -73,10 +73,10 @@ type Commands = BTreeMap<String, String>;
|
||||
pub enum Step {
|
||||
Asdf,
|
||||
Atom,
|
||||
Bin,
|
||||
BrewCask,
|
||||
BrewFormula,
|
||||
Bun,
|
||||
Bin,
|
||||
Cargo,
|
||||
Chezmoi,
|
||||
Chocolatey,
|
||||
@@ -87,8 +87,8 @@ pub enum Step {
|
||||
Containers,
|
||||
CustomCommands,
|
||||
DebGet,
|
||||
Distrobox,
|
||||
Deno,
|
||||
Distrobox,
|
||||
Dotnet,
|
||||
Emacs,
|
||||
Firmware,
|
||||
@@ -100,15 +100,17 @@ pub enum Step {
|
||||
Ghcup,
|
||||
GithubCliExtensions,
|
||||
GitRepos,
|
||||
GnomeShellExtensions,
|
||||
Go,
|
||||
Guix,
|
||||
Haxelib,
|
||||
GnomeShellExtensions,
|
||||
Helm,
|
||||
HomeManager,
|
||||
Jetpack,
|
||||
Julia,
|
||||
Juliaup,
|
||||
Kakoune,
|
||||
Helix,
|
||||
Krew,
|
||||
Macports,
|
||||
Mas,
|
||||
@@ -120,10 +122,11 @@ pub enum Step {
|
||||
Pacdef,
|
||||
Pacstall,
|
||||
Pearl,
|
||||
Pipx,
|
||||
Pip3,
|
||||
Pipx,
|
||||
Pkg,
|
||||
Pkgin,
|
||||
Pnpm,
|
||||
Powershell,
|
||||
Protonup,
|
||||
Raco,
|
||||
@@ -152,6 +155,7 @@ pub enum Step {
|
||||
Winget,
|
||||
Wsl,
|
||||
Yadm,
|
||||
Yarn,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
|
||||
@@ -348,7 +348,7 @@ fn run() -> Result<()> {
|
||||
runner.execute(Step::Go, "gup", || go::run_go_gup(run_type))?;
|
||||
runner.execute(Step::Emacs, "Emacs", || emacs.upgrade(&ctx))?;
|
||||
runner.execute(Step::Opam, "opam", || generic::run_opam_update(&ctx))?;
|
||||
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?;
|
||||
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(&ctx))?;
|
||||
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))?;
|
||||
@@ -367,13 +367,15 @@ fn run() -> Result<()> {
|
||||
runner.execute(Step::Vim, "The Ultimate vimrc", || vim::upgrade_ultimate_vimrc(&ctx))?;
|
||||
runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?;
|
||||
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
|
||||
runner.execute(Step::Helix, "helix", || generic::run_helix_grammars(&ctx))?;
|
||||
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
|
||||
runner.execute(Step::Node, "yarn", || node::run_yarn_upgrade(&ctx))?;
|
||||
runner.execute(Step::Node, "pnpm", || node::run_pnpm_upgrade(&ctx))?;
|
||||
runner.execute(Step::Yarn, "yarn", || node::run_yarn_upgrade(&ctx))?;
|
||||
runner.execute(Step::Pnpm, "pnpm", || node::run_pnpm_upgrade(&ctx))?;
|
||||
runner.execute(Step::Containers, "Containers", || containers::run_containers(&ctx))?;
|
||||
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;
|
||||
runner.execute(Step::Composer, "composer", || generic::run_composer_update(&ctx))?;
|
||||
runner.execute(Step::Krew, "krew", || generic::run_krew_upgrade(run_type))?;
|
||||
runner.execute(Step::Helm, "helm", || generic::run_helm_repo_update(run_type))?;
|
||||
runner.execute(Step::Gem, "gem", || generic::run_gem(&base_dirs, run_type))?;
|
||||
runner.execute(Step::RubyGems, "rubygems", || {
|
||||
generic::run_rubygems(&base_dirs, run_type)
|
||||
|
||||
@@ -89,7 +89,11 @@ pub fn run_rubygems(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
|
||||
|
||||
print_separator("RubyGems");
|
||||
|
||||
if !std::path::Path::new("/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb").exists() {
|
||||
run_type.execute(gem).args(["update", "--system"]).status_checked()
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_haxelib_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
@@ -260,14 +264,27 @@ pub fn run_opam_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_vcpkg_update(run_type: RunType) -> Result<()> {
|
||||
pub fn run_vcpkg_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
let vcpkg = utils::require("vcpkg")?;
|
||||
print_separator("vcpkg");
|
||||
|
||||
run_type
|
||||
.execute(vcpkg)
|
||||
.args(["upgrade", "--no-dry-run"])
|
||||
.status_checked()
|
||||
#[cfg(unix)]
|
||||
let is_root_install = !&vcpkg.starts_with("/home");
|
||||
|
||||
#[cfg(not(unix))]
|
||||
let is_root_install = false;
|
||||
|
||||
let mut command = if is_root_install {
|
||||
ctx.run_type().execute(&vcpkg)
|
||||
} else {
|
||||
let mut c = ctx
|
||||
.run_type()
|
||||
.execute(ctx.sudo().as_ref().ok_or(TopgradeError::SudoRequired)?);
|
||||
c.arg(&vcpkg);
|
||||
c
|
||||
};
|
||||
|
||||
command.args(["upgrade", "--no-dry-run"]).status_checked()
|
||||
}
|
||||
|
||||
pub fn run_pipx_update(run_type: RunType) -> Result<()> {
|
||||
@@ -471,6 +488,9 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||
let dotnet = utils::require("dotnet")?;
|
||||
|
||||
let dotnet_help_output = ctx.run_type().execute(&dotnet).arg("-h").output().err().unwrap();
|
||||
|
||||
if dotnet_help_output.to_string().contains("tool") {
|
||||
let output = Command::new(dotnet)
|
||||
.args(["tool", "list", "--global"])
|
||||
.output_checked_utf8()?;
|
||||
@@ -495,6 +515,26 @@ pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||
.status_checked()
|
||||
.with_context(|| format!("Failed to update .NET package {package_name}"))?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_helix_grammars(ctx: &ExecutionContext) -> Result<()> {
|
||||
utils::require("helix")?;
|
||||
|
||||
print_separator("Helix");
|
||||
|
||||
ctx.run_type()
|
||||
.execute(ctx.sudo().as_ref().ok_or(TopgradeError::SudoRequired)?)
|
||||
.args(["helix", "--grammar", "fetch"])
|
||||
.status_checked()
|
||||
.with_context(|| "Failed to download helix grammars!")?;
|
||||
|
||||
ctx.run_type()
|
||||
.execute(ctx.sudo().as_ref().ok_or(TopgradeError::SudoRequired)?)
|
||||
.args(["helix", "--grammar", "build"])
|
||||
.status_checked()
|
||||
.with_context(|| "Failed to build helix grammars!")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -546,3 +586,10 @@ pub fn update_julia_packages(ctx: &ExecutionContext) -> Result<()> {
|
||||
.args(["-e", "using Pkg; Pkg.update()"])
|
||||
.status_checked()
|
||||
}
|
||||
|
||||
pub fn run_helm_repo_update(run_type: RunType) -> Result<()> {
|
||||
let helm = utils::require("helm")?;
|
||||
|
||||
print_separator("Helm");
|
||||
run_type.execute(helm).arg("repo").arg("update").status_checked()
|
||||
}
|
||||
|
||||
@@ -102,6 +102,12 @@ pub fn run_fisher(run_type: RunType) -> Result<()> {
|
||||
.and_then(|output| Path::new(&output.stdout.trim()).require().map(|_| ()))
|
||||
.map_err(|err| SkipStep(format!("`fish_plugins` path doesn't exist: {err}")))?;
|
||||
|
||||
Command::new(&fish)
|
||||
.args(["-c", "fish_update_completions"])
|
||||
.output_checked_utf8()
|
||||
.map(|_| ())
|
||||
.map_err(|_| SkipStep("`fish_update_completions` is not available".to_owned()))?;
|
||||
|
||||
print_separator("Fisher");
|
||||
|
||||
let version_str = run_type
|
||||
|
||||
@@ -21,8 +21,9 @@ use which_crate::which;
|
||||
use crate::command::CommandExt;
|
||||
use crate::report::StepResult;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::terminal;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::utils::which;
|
||||
|
||||
lazy_static! {
|
||||
static ref TERMINAL: Mutex<Terminal> = Mutex::new(Terminal::new());
|
||||
}
|
||||
@@ -105,7 +106,7 @@ impl Terminal {
|
||||
command.args(["-a", "Topgrade", "Topgrade"]);
|
||||
command.arg(message.as_ref());
|
||||
if let Err(err) = command.output_checked() {
|
||||
tracing::error!("{err:?}");
|
||||
terminal::print_warning("Senfing notification failed with {err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user