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 new badges #704 #742

Merged
merged 6 commits into from
Jul 15, 2017
Merged

add new badges #704 #742

merged 6 commits into from
Jul 15, 2017

Conversation

marti1125
Copy link
Contributor

I added new Badges @carols10cents please review the enums. Thanks!!
And also I had this error =/
https://gist.github.com/marti1125/d2ddda017b9e1c8a4224cf48cc2a42b1

@carols10cents
Copy link
Member

Hi @marti1125! Thank you for the PR and I'm sorry it's taken me so long to look at this!

Regarding the errors you got, was this when you ran cargo test or cargo build or cargo run --bin server or something else?

Could you run cargo clean and then whatever command you ran with -v to get verbose output and put everything that outputs into a gist please?

Regarding the code, I think I was unclear when we chatted last. I was imagining one new enum variant for maintenance that would have ActivelyDeveloped, PassivelyMaintained, and so on as the possible values for that variant. Also, this variant would not need the repository key; those are used to configure the other badges since crates.io needs to tell services like TravisCI where the project that goes with the crate is, which might not match the crate name. This badge doesn't involve any outside services, and it will just display the value without caring where the project's repository is.

In other words, what I think crate authors should be able to specify in their Cargo.toml would look like this (the TOML parser is expecting a HashMap of String keys mapping to String values, so we do need to have some sort of key/value in here even though it won't be repository):

[badges]
maintenance = { value = "passively-maintained" }

That will have cargo send this JSON to crates.io when a crate gets published:

{
    "name": "your-crate-name",
    // all the other metadata in here
    "badges": {"maintenance": {"value":"passively-maintained"}}
}

Then, when crates.io uses serde to deserialize this JSON, it should match a Maintenance variant in the Badge enum. A crate will have the Badge::Maintenance badge if the maintainer has specified any value, and the crate won't have this badge if the maintainer has not specified any value.

When we go to display the badge, the text of the badge will come from looking up the value within that badge.

Does that make sense? Are you up for making that change to this PR? Please ask questions if I'm still not being clear! Thank you!!

@carols10cents
Copy link
Member

Hi @marti1125, just checking in on this PR-- will you have time soon to make changes to this PR? Thanks!

@marti1125
Copy link
Contributor Author

@carols10cents sorry for the big delay I will restart with this issue tomorrow. I will see you at irc channel 👍

@marti1125
Copy link
Contributor Author

@carols10cents please review my commit thanks!

marti1125 and others added 6 commits July 14, 2017 19:05
This nests the data too much; serialized JSON looks like this, which has
an extra value key:

```
{
  "badge_type": "maintenance",
  "attributes": {
    "value": {
      "value": "looking-for-maintainer"
     }
  }
}
```
@carols10cents carols10cents merged commit d11819c into rust-lang:master Jul 15, 2017
@carols10cents
Copy link
Member

Hi! The code needed a few more changes, and I added some tests to make sure everything was working. I also updated the checklist! Thank you!! 🌞 🌝 🌷

@marti1125
Copy link
Contributor Author

@carols10cents great! 👍

@marti1125
Copy link
Contributor Author

could you explain me more about the others tasks? please 😄

@carols10cents
Copy link
Member

what would you like to know?

@marti1125
Copy link
Contributor Author

  • Add an ember component like the other badge components in app/components
  • Add a template in app/templates/components to display the badge

@carols10cents
Copy link
Member

What questions do you have about these tasks?

@marti1125
Copy link
Contributor Author

  • Add an ember component like the other badge components in app/components
    could you tell me what components I have to modify? please

@carols10cents
Copy link
Member

could you tell me what components I have to modify?

You do not need to modify any components, you need to create a new component in a file named app/components/badge-maintenance.js. In the app/components/ directory, there are other badge components that will be good examples for what needs to go in that new file.

Does that make sense?

Do you have the frontend of the app running on your local machine? Do you have the backend running on your local machine? If so, have you tried publishing a crate to your local backend? If you are able to do that, you should be able to publish a crate with a maintenance badge in that crate's Cargo.toml in order to get the right data in your database in order to test with. If you don't have a backend set up or you have problems publishing a crate to it, another option is to modify the frontend test fixture data in mirage/fixtures/crates.js to add to the fake badges data in, for example, the fake "rust_mixin" crate here: https://github.com/rust-lang/crates.io/blob/master/mirage/fixtures/crates.js#L60 Then you can run the front end with npm run start to use the fixture data.

That way, you can better see the results of what you're doing. Does that make sense?

If not, please ask more questions!!

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.

3 participants