-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bump crates version from the latest crates.io version #12
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
src/crate_details.rs
Outdated
} | ||
|
||
// Does the current version of this crate exist on crates.io? | ||
// If so, we need to bump the current version. | ||
let known_versions = external::crates_io::get_known_crate_versions(&self.name)?; | ||
Ok(known_versions.contains(&self.version)) | ||
self.known_versions = external::crates_io::get_known_crate_versions(&self.name)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd prob just call this in CrateDetails::load
, prob just with a little interface like:
pub struct CrateVersions {
name: String
versions: RefCell<Option<HashSet<Version>>>
}
impl CrateVersions {
pub fn new(crate_name: String) -> Self { ... }
pub fn get(&self) -> &HashSet<Versions> {
// get from cache or load from crates.io if not obtained yet)
}
}
That way the bump version function isn't dependant on this one running first or whatever in order to work properly :)
Looks great to me; just a wee suggestion for tidiness so that the order that we call functions in doesn't matter :) |
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
This PR guarantees that when preparing for publication on crates.io, the latest version of the crate is obtained directly from crates.io.
By doing so, any differences in versions between the local repository, which might contain an outdated version and the versions on crates.io are avoided.
While at it, fixed clippy and applied cargo fmt
Testing Done
// @paritytech/subxt-team