-
Notifications
You must be signed in to change notification settings - Fork 26
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 directory paths #39
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
c05ca04
to
126be72
Compare
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: ErrorInner { kind: Custom, line: None, col: 0, at: None, message: "missing field `tools`", key: [] } }', src/config.rs:97:69 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note on this test (and tests/snapshots/install_invalid_tool_configuration.snap): I've let these in even if they're not great just to document the current behavior. I have some changes locally that I'll put up once this merges that refactor the error handling to get better output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just had one comment on error messaging. Could be addressed in your followup if you like
src/tool_cache.rs
Outdated
.args(args) | ||
.status() | ||
.map_err(|e| { | ||
format!( | ||
"an error happened trying to run `{}` at `{}`: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this error occur? If there's any chance it could happen for end users, we should make sure the error is very clear about it being foreman's problem, so they don't chase ghosts in whatever tool they were trying to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right, I'll precise that in the message!
I refactored how the paths for the different files and directories are obtained, so that it's possible to specify the root from an environment variable. This made it simple to write to integration tests on the CLI that snapshots the content of file generated by foreman.
I don't want to go too deep in the test cases for this PR, but this sets up the pattern.
Closes #17