Rustup should update itself when appropriate (fixes #30)
This commit is contained in:
@@ -29,6 +29,7 @@ Just run `topgrade`. It will run the following steps:
|
||||
* Custom defined paths
|
||||
* *Unix*: Run [zplug](https://github.com/zplug/zplug) update
|
||||
* *Unix*: Upgrade tmux plugins with [TPM](https://github.com/tmux-plugins/tpm)
|
||||
* Update Rustup by running `rustup update`. This will also attempt to run `rustup self update` when Rustup is installed inside the home directory.
|
||||
* Run Cargo [install-update](https://github.com/nabijaczleweli/cargo-update)
|
||||
* Upgrade Emacs packages
|
||||
* Upgrade Vim packages. Works with the following plugin frameworks:
|
||||
|
||||
10
src/steps.rs
10
src/steps.rs
@@ -1,7 +1,9 @@
|
||||
use super::utils::Check;
|
||||
use failure;
|
||||
use std::env::home_dir;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use utils::is_ancestor;
|
||||
|
||||
const EMACS_UPGRADE: &str = include_str!("emacs.el");
|
||||
|
||||
@@ -111,6 +113,14 @@ pub fn run_fwupdmgr(fwupdmgr: &PathBuf) -> Result<(), failure::Error> {
|
||||
}
|
||||
|
||||
pub fn run_rustup(rustup: &PathBuf) -> Result<(), failure::Error> {
|
||||
if is_ancestor(&home_dir().unwrap(), &rustup) {
|
||||
Command::new(rustup)
|
||||
.args(&["self", "update"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
}
|
||||
|
||||
Command::new(rustup).arg("update").spawn()?.wait()?.check()?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user