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

Error with document_and_reload() if the param file in get_golem_config is a function calling app_sys() #1178

Open
LDSamson opened this issue Sep 9, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@LDSamson
Copy link

LDSamson commented Sep 9, 2024

To Reproduce

  1. Open a new Golem project and replace the get_golem_config() file paramer (file = app_sys("golem-config.yml") ) with the following:
    file = Sys.getenv("CONFIG_PATH", app_sys("golem-config.yml")).
  2. Run golem::run_dev

The following error will occur in golem version 0.5.0 or 0.5.1, but not in golem version 0.4.1:

Error in guess_where_config(path) : 
  It appears that two golem config files exist:
- the default 'inst/golem-config.yml'
- file read from an app_sys()-call in 'R/app_config.R'
=> Resolve via either of the two options:
1. KEEP USER-FILE: rename/delete default 'inst/golem-config.yml'
2. KEEP DEFAULT: change 'app_sys(...)' to 'app_sys('golem-config.yml')'.

I think it goes wrong in the function guess_lines_to_config_file (called internally by golem::document_and_reload() ). This function expects the file argument only to contain a single call to app_sys() and uses regex to retrieve this call. It does not recognize the use case described above and will return a broken user path similar to this:

C:/app_location/test_golemapp/inst/CONFIG_PATH", app_sys("golem-config.yml
Session Info version R version 4.4.1 (2024-06-14 ucrt) os Windows 11 x64 (build 22631) system x86_64, mingw32 ui RStudio language en collate German_Germany.utf8 ctype German_Germany.utf8 tz Europe/Berlin date 2024-09-09 rstudio 2024.04.2+764 Chocolate Cosmos (desktop) pandoc NA

─ Packages ! package * version date (UTC) lib source
P attempt 0.3.1 2020-05-03 [?] RSPM
P cachem 1.1.0 2024-05-16 [?] RSPM
P cli 3.6.3 2024-06-21 [?] CRAN (R 4.4.1)
P config 0.3.2 2023-08-30 [?] RSPM
P devtools 2.4.5 2022-10-11 [?] RSPM
P digest 0.6.37 2024-08-19 [?] RSPM
P ellipsis 0.3.2 2021-04-29 [?] RSPM
P fastmap 1.2.0 2024-05-15 [?] RSPM
P fs 1.6.4 2024-04-25 [?] RSPM (R 4.4.0)
P glue 1.7.0 2024-01-09 [?] RSPM (R 4.4.0)
P golem 0.5.1 2024-08-27 [?] RSPM
P htmltools 0.5.8.1 2024-04-04 [?] RSPM (R 4.4.0)
P htmlwidgets 1.6.4 2023-12-06 [?] RSPM
P httpuv 1.6.15 2024-03-26 [?] RSPM (R 4.4.0)
P later 1.3.2 2023-12-06 [?] RSPM (R 4.4.0)
P lifecycle 1.0.4 2023-11-07 [?] RSPM (R 4.4.0)
P magrittr 2.0.3 2022-03-30 [?] RSPM (R 4.4.0)
P memoise 2.0.1 2021-11-26 [?] RSPM (R 4.4.0)
P mime 0.12 2021-09-28 [?] RSPM (R 4.4.0)
P miniUI 0.1.1.1 2018-05-18 [?] RSPM
P pkgbuild 1.4.4 2024-03-17 [?] RSPM
P pkgload 1.4.0 2024-06-28 [?] RSPM
P profvis 0.3.8 2023-05-02 [?] RSPM
P promises 1.3.0 2024-04-05 [?] RSPM (R 4.4.0)
P purrr 1.0.2 2023-08-10 [?] RSPM
P R6 2.5.1 2021-08-19 [?] RSPM (R 4.4.0)
P Rcpp 1.0.13 2024-07-17 [?] RSPM
P remotes 2.5.0 2024-03-17 [?] RSPM
renv 1.0.7 2024-04-11 [1] CRAN (R 4.4.1)
P rlang 1.1.4 2024-06-04 [?] CRAN (R 4.4.1)
P rstudioapi 0.16.0 2024-03-24 [?] RSPM
P sessioninfo 1.2.2 2021-12-06 [?] RSPM
P shiny 1.9.1 2024-08-01 [?] RSPM
P stringi 1.8.4 2024-05-06 [?] RSPM
P stringr 1.5.1 2023-11-14 [?] RSPM
P urlchecker 1.0.1 2021-11-30 [?] RSPM
P usethis 3.0.0 2024-07-29 [?] CRAN (R 4.4.1)
P vctrs 0.6.5 2023-12-01 [?] RSPM (R 4.4.0)
P xtable 1.8-4 2019-04-21 [?] RSPM (R 4.4.0)
P yaml 2.3.10 2024-07-26 [?] CRAN (R 4.4.1)

@LDSamson LDSamson added the bug Something isn't working label Sep 9, 2024
@LDSamson LDSamson changed the title Error with document_and_reload() if the file path is a flexible function containing a call to app_sys() Error with document_and_reload() if the param file in get_golem_config is a function calling app_sys() Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants