Skip to content
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

RFC: rover update #159

Open
EverlastingBugstopper opened this issue Dec 24, 2020 · 3 comments
Open

RFC: rover update #159

EverlastingBugstopper opened this issue Dec 24, 2020 · 3 comments
Labels
feature 🎉 new commands, flags, functionality, and improved error messages

Comments

@EverlastingBugstopper
Copy link
Contributor

EverlastingBugstopper commented Dec 24, 2020

I'm proposing that we add a rover update that automatically updates the binary to the latest version. There are a few decisions to be made about its behavior that I'll outline below.

got some pseudocode here for what i think a good behavior pattern would be for this command.

  1. default rover update behavior
// this will allow us to use `<` and `>` when comparing versions
use semver::Version;

let current_path = env::current_exe();
let current_version = Version::parse(env!(CARGO_PKG_VERSION));
let is_this_beta = is_version_beta(current_version);
let (latest_stable_version, latest_beta_version): (Version, Version) = get_latest_versions();
let latest_latest_version = if latest_stable_version > latest_beta_version {
  latest_stable_version.clone()
} else {
  latest_beta_version.clone()
};

if is_this_beta && latest_latest_version > current_version {
  update_exe(&current_path, latest_latest_version)
} else if is_this_beta {
  Err(anyhow!("You are currently running the latest version!"))
} else if !is_this_beta && latest_stable_version > current_version {
  update_exe(&current_path, latest_stable_version);
} else if !is_this_beta && latest_beta_version > current_version {
  Err(anyhow!("You are currently running the latest stable version. You can rerun this command with the `--beta` flag to update to version {}", latest_beta_version))
}
  1. rover update --beta would look very similar to the above except it would never update to a stable release, instead always trying to update to the latest stable release and returning an error if it couldn't find anything newer

  2. rover update --version v1.0.0 (equivalent to --version 1.0.0 or at least letting you know to prefix with a v) would let you install a specific version of rover and error if it could not find that version

  3. rover update list would list all of the available releases to update to

the update_exe fn from above is pretty much implemented already in binstall so the work here is primarily around deciding if the default behavior i've lined out is OK in addition to some GitHub API queries.

@EverlastingBugstopper EverlastingBugstopper added feature 🎉 new commands, flags, functionality, and improved error messages status - needs review labels Dec 24, 2020
@EverlastingBugstopper EverlastingBugstopper self-assigned this Dec 24, 2020
@lrlna
Copy link
Member

lrlna commented Jan 11, 2021

I am wondering if we should model this API after rustup update. It works a little bit differently than what you proposed (usage-wise), but has the same idea. The way I see us have this feature is like so:

  1. rover update: updates to latest available version based on your current release type. If your current version is 1.0.0.beta1, update to 1.0.0.beta2. If you're on 1.0.0, update to the 1.1.0. If you're on a release candidate, update to next available release candidate.
  2. rover update <release_type>. Update to the latest version of a release type. So
    • rover update stable for a stable update
    • rover update beta for a beta update
    • rover update 0.2.3 for a specific version, and finally
    • rover update release_candidate if we chose to support release candidate updates as well.

How would you feel about the above tweaks?

I really like the idea of rover update list, btw! That one is a keeper.

@EverlastingBugstopper
Copy link
Contributor Author

love it. i think that approach is much better!

@lrlna lrlna added this to the 0.0.3 milestone Feb 19, 2021
@lrlna
Copy link
Member

lrlna commented Feb 19, 2021

A note: this flow should perhaps also include 'install from a commit sha' flow. But for this we can do point people to checkout the commit and run cargo run -- install on that commit/branch.

@lrlna lrlna modified the milestones: 0.0.3, 0.0.4 Feb 19, 2021
@lrlna lrlna modified the milestones: March 23, March 30 - GA, May 4 Mar 5, 2021
@lrlna lrlna modified the milestones: May 11 - GA, June 8 Apr 16, 2021
@EverlastingBugstopper EverlastingBugstopper modified the milestones: June 8, June 22 Jun 8, 2021
@abernix abernix modified the milestones: June 22, July 6, 2021, July 6, Qx Jun 9, 2021
@EverlastingBugstopper EverlastingBugstopper removed their assignment Aug 13, 2021
@EverlastingBugstopper EverlastingBugstopper removed this from the Qx milestone Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

No branches or pull requests

4 participants