Closed ilyaZar closed 1 year ago
Thanks a lot @ilyaZar !
I will take the time to review your PR asap. In the mean time I quickly eye-balled on the code and made a few comments.
Just refactored the logic for the whole file because it got complicated and messy. Here is a summary of all changes of this PR so far:
try_user_config_location()
inside guess_where_config()
which finds a user supplied config-yaml by reading its new path location from changes in the "R/app_config.R" file&&
instead of &
with logical scalarstry_user_config_location()
; also add support for multi-line statements of app_sys()
inside R/app_config.R
; update tests to check the new behaviour improving code coverage of R/config.R
to 63.16%guess_where_config()
-> since the user can now set paths to his/her golem-configs this must be properly handledR/config.R
to 68.87%guess_where_config()
fails slightly faster which is probably good as we can then handle the failure as another corner case explicitlyyesno()
into separate function call to improve function logic and make guess_where_config()
testable in interactive mode via the package {mockery}
R/config.R
@VincentGuyader do you think above CI failures relate to #1072 or #1070 ? my forked branch passed the tests on my local machine hence the question.
if you point me somewhere I'll try to fix the PR myself to make it pass the CI. thanks!
Fix #887
Problem: Whenever
golem::document_and_reload()
callsget_golem_wd()
to retrieve values from a yml-config, and the user changed the location of that yml before that call,golem::document_and_reload()
is not aware of that location change and fails. Specifically,guess_where_config()
cannot find the location when it is not of standard type (e.g. "inst/golem-config.yml").Fix: This PR solves this by adding a helper to
guess_where_config()
which finds the user config-yaml by reading its new location from user changes in "R/app_config.R".