Skip to content

Commit

Permalink
refactor: Pun index logic to crates-index
Browse files Browse the repository at this point in the history
This was inspired by running into errors where `cargo add inquire` was
not adding the latest version.  We've seen similar problems during the
development of `crates-index`, so hoping what they've done fixes this.

Even if it doesn't solve this problem, hopefully by nature of using a
shared crate means it will get more use and more eyes to make it more
reliable in the long term.

Handling retrying the index is annoying.  I opened
frewsxcv/rust-crates-index#62

Note: in the next version of crates-index
- Opening an index will implicitly create it, so we won't be able to
  differentiate in our message whether we are initializing or updating.
  See frewsxcv/rust-crates-index#61
- We will be able to open an Index by URL, which will allow us to remove
  more logic
  • Loading branch information
epage committed Aug 30, 2021
1 parent 95b9359 commit 55d7de2
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 234 deletions.
81 changes: 67 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ required-features = ["upgrade"]
[dependencies]
atty = { version = "0.2.14", optional = true }
cargo_metadata = "0.14.0"
crates-index = "0.17.0"
dirs-next = "2.0.0"
env_proxy = "0.4.1"
error-chain = "0.12.4"
Expand Down
2 changes: 2 additions & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ error_chain! {
Io(::std::io::Error) #[doc = "An error from the std::io module"];
Git(::git2::Error)#[doc = "An error from the git2 crate"];
CargoMetadata(::failure::Compat<::cargo_metadata::Error>)#[doc = "An error from the cargo_metadata crate"];
Semver(::semver::Error)#[doc = "An error from the semver crate"];
CratesIndex(::crates_index::Error)#[doc = "An error from the crates-index crate"];
}

errors {
Expand Down
Loading

0 comments on commit 55d7de2

Please sign in to comment.