8000 refactor: reimplement download of latest versions by augustoccesar · Pull Request #248 · mentimeter/linkup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: reimplement download of latest versions #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions linkup-cli/src/commands/update.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::{commands, current_version, linkup_exe_path, release, InstallationMethod, Result};
use anyhow::Context;
use std::fs;

use crate::{commands, current_version, linkup_exe_path, release, InstallationMethod, Result};

#[derive(clap::Args)]
pub struct Args {
/// Ignore the cached last version and check remote server again for the latest version.
Expand Down Expand Up @@ -33,12 +35,12 @@ pub async fn update(args: &Args) -> Result<()> {
if args.skip_cache {
log::debug!("Clearing cache to force a new check for the latest version.");

release::clear_cache();
release::CachedReleases::clear();
}

let requested_channel = args.channel.as_ref().map(linkup::VersionChannel::from);

match release::available_update(&current_version, requested_channel).await {
match release::check_for_update(&current_version, requested_channel).await {
Some(update) => {
commands::stop(&commands::StopArgs {}, false)?;

Expand All < 8A35 /td> @@ -50,7 +52,11 @@ pub async fn update(args: &Args) -> Result<()> {
&update.version.channel()
);

let new_linkup_path = update.linkup.download_decompressed("linkup").await.unwrap();
let new_linkup_path = update
.binary
.download()
.await
.with_context(|| "Failed to download new version")?;

let current_linkup_path = linkup_exe_path()?;
let bkp_linkup_path = current_linkup_path.with_extension("bkp");
Expand Down Expand Up @@ -87,7 +93,7 @@ pub async fn update(args: &Args) -> Result<()> {
}

pub async fn new_version_available() -> bool {
release::available_update(&current_version(), None)
release::check_for_update(&current_version(), None)
.await
.is_some()
}
Expand Down
Loading
0