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

read cargo configs with/without .toml extension + make public API clearer #437

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chrismooredev
Copy link

@chrismooredev chrismooredev commented Dec 3, 2020

The goal for my series of commits is to consolidate repeated functionality and make this crate easier to use for those using it's public Rust API.

commit ff1e158:

  • prevents cargo_edit::registry::cargo_home from unnecessarily getting $HOME, or checking UTF8 compliance.

commit 03f6d74: introduce new structs to drive a new public, programmable API

  • supports reading both bare .cargo/config and .cargo/config.toml files
  • added documentation
  • puts some of the public API into new RegistryReq and RegistryIndex structs, and attaches many of the freestanding functions in cargo_edit::registry into those.
    • RegistryReq notably allows a new user of the public API to more easily figure out the latest dependency of a crate without supplying a project directory.

commit 1c986a6:

  • rolls back changed public signatures, to forward to the new functions, with deprecation warnings
  • moves implementations to their respective RegistryReq and RegistryIndex structs

commit 933ebfe:

  • bakes in the generated binary paths (cargo-add/cargo-rm/cargo-update) for testing purposes
  • also enables testing this crate within a cargo workspace, as the target/ dir is not in the expected crate root or CWD location for those.

I plan to do a major bump once I am done editing the public API, if that is welcomed :)

also prevent unnecessary UTF8 compliance assertion for $CARGO_HOME
(registry.rs) broke `registry_url` down into smaller functions
(registry.rs) implemented RegistryReq struct, meant to abstract the idea of 'getting a registry'
	- allows obtaining a registry without attaching a project directory, or traversing the file system (direct URL)
(fetch.rs) seperate concerns with get_latest_dependency
	- caller shouldn't have to get the registry URL - just know the context of the request
(upgrade/main.rs) add comments to & reorganize DesiredUpgrades::get_upgraded
@chrismooredev chrismooredev changed the title stop cargo_home from unnecessarily getting $HOME read cargo configs with/without .toml extension + make public API clearer Dec 13, 2020
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.

1 participant