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

refactor: getting project name #774

Conversation

chesedo
Copy link
Contributor

@chesedo chesedo commented Mar 31, 2023

Description of change

This PR improves how we get the name of the project and how we identify the root Cargo.toml file in a project.

This is the preferred order for a project name:

  1. Name given on command line
  2. Name from Shuttle.toml file
  3. Name from Cargo.toml package if it's a crate
  4. Name from the workspace directory if it's a workspace

How Has This Been Tested (if applicable)?

By running the tests locally and adding new tests. Note, the tests require shuttle-hq/shuttle-examples#35

Copy link
Contributor

@oddgrd oddgrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good idea getting the project name from the workspace file_name, I'll add a note about updating the docs with this as well.

cargo-shuttle/src/args.rs Outdated Show resolved Hide resolved
PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap())
.join("..")
.join(path)
.canonicalize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain this would be an issue, but should we use dunce::canonicalize to be safe on windows?

chesedo and others added 2 commits March 31, 2023 14:11
Co-authored-by: Oddbjørn Grødem <29732646+oddgrd@users.noreply.github.com>
@chesedo chesedo merged commit 70457b0 into shuttle-hq:main Mar 31, 2023
@chesedo chesedo deleted the feature/eng-561-find-the-project-and-service-names branch March 31, 2023 12:13
@chesedo chesedo mentioned this pull request Mar 31, 2023
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.

2 participants