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

Add version option for upgrade #5156

Merged
merged 4 commits into from
May 9, 2020

Conversation

crowlKats
Copy link
Member

This would close #5146.
It isnt exactly complete yet:

  • there should be a check if the version passed is equal to the current version
  • right now the output is:
$ ./target/debug/deno upgrade --dry-run --version v0.42.0
Checking for latest version
Invalid semver passed

The checking for latest version should only happen if version is not passed

@crowlKats
Copy link
Member Author

now the previous listed missing features have been implemented

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is welcome - thanks. Can you add a test tho? I think you can base it on this test:

// Warning: this test requires internet access.
#[test]
fn upgrade_in_tmpdir() {
let temp_dir = TempDir::new().unwrap();
let exe_path = if cfg!(windows) {
temp_dir.path().join("deno")
} else {
temp_dir.path().join("deno.exe")
};
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
assert!(exe_path.exists());
let _mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap();
let status = Command::new(&exe_path)
.arg("upgrade")
.arg("--force")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
let _mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap();
// TODO(ry) assert!(mtime1 < mtime2);
}

@crowlKats
Copy link
Member Author

@ry will this suffice?

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice patch!

@ry ry merged commit abbf033 into denoland:master May 9, 2020
@crowlKats crowlKats deleted the deno_upgrade_specific_version branch May 9, 2020 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow version argument in deno upgrade
2 participants