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

Return error if name in crates.io is different #78

Closed
wants to merge 3 commits into from

Conversation

caulagi
Copy link
Contributor

@caulagi caulagi commented Mar 4, 2016

As described in #51, I have added a check to validate the crate_name is the same as the one on crates.io or return an error.

$ ./target/debug/cargo-add add error-def
Command failed due to unhandled error: crates.io Error: NotFound
$
$ ./target/debug/cargo-add add error_def
$

I have added a couple of tests as well, but they actually hit crates.io endpoint.

@caulagi caulagi changed the title 🐛 Return error if name in crates.io is different Return error if name in crates.io is different Mar 4, 2016
@killercup
Copy link
Owner

Am I understanding correctly that the crates.io API actually gives us the
'correct' (i.e. normalized) name?

Would it then not make sense to just insert the normalized name (and maybe
tell the user the new name in a log message)?

Pradip Caulagi notifications@github.com schrieb am Fr., 4. März 2016 um
11:17:

As described in #51 #51,
I have added a check to validate the crate_name is the same as the one on
crates.io or return an error.

$ ./target/debug/cargo-add add error-def
Command failed due to unhandled error: crates.io Error: NotFound
$
$ ./target/debug/cargo-add add error_def
$

I have added a couple of tests as well, but they actually hit crates.io

endpoint.

You can view, comment on, or merge this pull request online at:

#78
Commit Summary

  • 🐛 Return error if name in crates.io is different from the name
    that is

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#78.

@caulagi
Copy link
Contributor Author

caulagi commented Mar 8, 2016

Yes, that is my understanding as well, that crates.io gives the normalised name only for the case when there is a mismatch between underscores and hyphens. In other cases, where the crate name is mis-spelled/not-matching, we get "not found". I asked a question here - rust-lang/crates.io#283 - as I don't know if this is something that can be relied on.

@homu
Copy link
Contributor

homu commented Apr 9, 2016

☔ The latest upstream changes (presumably #83) made this pull request unmergeable. Please resolve the merge conflicts.

@sinkuu
Copy link

sinkuu commented Jan 1, 2017

I'm writing an editor extension to run cargo add for extern crateed missing dependencies, so I prefer correct name is used instead.

@killercup killercup mentioned this pull request Jan 2, 2017
homu added a commit that referenced this pull request Jan 3, 2017
…rcup

New year, new bugfixes

This is a rollup of #98 (which replaces #78), #99, and #100.

@sebasgarcep and @sinkuu, thank you for your PRs! Do you have time to review this? I've add a few tests and changed to code slightly, before running Rustfmt and Clippy.

Just to make sure Github gets all the references:

Fixes #52
Fixes #88
Fixes #92
@killercup
Copy link
Owner

Superseded by #101

@killercup killercup closed this Jan 3, 2017
@caulagi caulagi deleted the bug/add-name-check branch January 3, 2017 09:04
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.

4 participants