feat: support update PlatformIO Core (#759)
This commit is contained in:
@@ -121,6 +121,7 @@ pub enum Step {
|
|||||||
Pipx,
|
Pipx,
|
||||||
Pkg,
|
Pkg,
|
||||||
Pkgin,
|
Pkgin,
|
||||||
|
PlatformioCore,
|
||||||
Pnpm,
|
Pnpm,
|
||||||
Powershell,
|
Powershell,
|
||||||
Protonup,
|
Protonup,
|
||||||
|
|||||||
@@ -407,6 +407,9 @@ fn run() -> Result<()> {
|
|||||||
runner.execute(Step::Certbot, "Certbot", || generic::run_certbot(&ctx))?;
|
runner.execute(Step::Certbot, "Certbot", || generic::run_certbot(&ctx))?;
|
||||||
runner.execute(Step::GitRepos, "Git Repositories", || git::run_git_pull(&ctx))?;
|
runner.execute(Step::GitRepos, "Git Repositories", || git::run_git_pull(&ctx))?;
|
||||||
runner.execute(Step::ClamAvDb, "ClamAV Databases", || generic::run_freshclam(&ctx))?;
|
runner.execute(Step::ClamAvDb, "ClamAV Databases", || generic::run_freshclam(&ctx))?;
|
||||||
|
runner.execute(Step::PlatformioCore, "PlatformIO Core", || {
|
||||||
|
generic::run_platform_io(&ctx)
|
||||||
|
})?;
|
||||||
|
|
||||||
if should_run_powershell {
|
if should_run_powershell {
|
||||||
runner.execute(Step::Powershell, "Powershell Modules Update", || {
|
runner.execute(Step::Powershell, "Powershell Modules Update", || {
|
||||||
|
|||||||
@@ -940,3 +940,23 @@ pub fn run_freshclam(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator("Update ClamAV Database(FreshClam)");
|
print_separator("Update ClamAV Database(FreshClam)");
|
||||||
ctx.run_type().execute(freshclam).status_checked()
|
ctx.run_type().execute(freshclam).status_checked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Involve `pio upgrade` to update PlatformIO core.
|
||||||
|
pub fn run_platform_io(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
// We use the full path because by default the binary is not in `PATH`:
|
||||||
|
// https://github.com/topgrade-rs/topgrade/issues/754#issuecomment-2020537559
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn bin_path() -> PathBuf {
|
||||||
|
HOME_DIR.join(".platformio/penv/bin/pio")
|
||||||
|
}
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn bin_path() -> PathBuf {
|
||||||
|
HOME_DIR.join(".platformio/penv/Scripts/pio.exe")
|
||||||
|
}
|
||||||
|
|
||||||
|
let bin_path = require(bin_path())?;
|
||||||
|
|
||||||
|
print_separator("PlatformIO Core");
|
||||||
|
|
||||||
|
ctx.run_type().execute(bin_path).arg("upgrade").status_checked()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user