The appveyor badge on https://crates.io/crates/erlang_nif-sys does not load, however the link does work when clicked.
The problem is that the link to the appveyor project requires underscores converted to dashes, but the link to the badge requires an unmangled name. The current crates.io code appears to use the same name for both.
I currently use a premangled repository name in the badges section:
[badges]
travis-ci = { repository = "goertzenator/erlang_nif-sys" }
appveyor = { repository = "goertzenator/erlang-nif-sys" }
The resulting broken badge URL
https://ci.appveyor.com/api/projects/status/github/goertzenator/erlang-nif-sys?svg=true&branch=master
The corrected URL is:
https://ci.appveyor.com/api/projects/status/github/goertzenator/erlang_nif-sys?svg=true&branch=master
I expect I could make the badge image to work by changing the badge setting to appveyor = { repository = "goertzenator/erlang_nif-sys" }, but then the link would break. I think both should work.
Do you know, or have links for, when in general mangling is needed?
I think fixing this will involve adding a repository_mangled field to badge-appveyor.js with js for mangling and modifying badge-appveyor.hbs to accept it. But I am new to the project so there may be better ways to do this.
I'm not aware of any documented mangling.
For fun I just created a new github repo and added it to appveyor, and sure enough the underscore was converted to a dash in the URL.
Could the unmangled repo name be dug out from here?:
https://ci.appveyor.com/api/projects/goertzenator/erlang-nif-sys/settings
<RepositoryName>goertzenator/erlang_nif-sys</RepositoryName>
<RepositoryScm>git</RepositoryScm>
<RepositoryType>gitHub</RepositoryType>
Alternatively, that settings page also contains...
<WebhookId>rssa03e29mxou4hv</WebhookId>
And with that the badge can be fetched more robustly:
https://ci.appveyor.com/api/projects/status/rssa03e29mxou4hv?svg=true
When I go to the settings page I get
<Error>
<Message>Authorization required</Message>
</Error>
I think crates.io should expect an unmangled name, so you should specify:
[badges]
appveyor = { repository = "goertzenator/erlang_nif-sys" }
Then the appveyor component should have another computed property that replaces _ in the badge.attributes.repository with -. I'd probably name the computed property normalizedRepository, just because "mangled" sounds like we're making the repository name unrecognizable or something.
And then badge-appveyor.hbs should use normalizedRepository for the a href.
I agree with that direction @carols10cents , but I'd like to suggest some refinements:
normalizedRepository is really just the project name in Appveyor lingo. Consider calling it project or projectname.project, but the default will be computed from repository. For example...[badges]
appveyor = { repository = "goertzenator/erlang_nif-sys", project = "goertzenator/erlang-nif-sys"}
The motivation for this come from this bug in which the Appveyor project name does not follow changes in repository name. Being able to separately specify repository and project would help in this case:
[badges]
appveyor = { repository = "goertzenator/erlang_nif-sys", project = "goertzenator/totally_new_repo"}
That all sounds good, @goertzenator! Also the documentation (that lives in cargo) should be updated to reflect whatever gets implemented here.
@carols10cents, @goertzenator If no one is working on this, I wouldn't mind giving it a shot.
was this fix deployed to crates.io? because it doesn't work for me
https://crates.io/crates/rust_info
Not yet, sorry! Will deploy right now.
thanks
Most helpful comment
@carols10cents, @goertzenator If no one is working on this, I wouldn't mind giving it a shot.