-
Notifications
You must be signed in to change notification settings - Fork 131
golem::add_(module, fct,...) appends to file if already exists #393
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
Labels
bug
Something isn't working
Comments
we should skip the writing part if the file already exists, for example at https://github.com/ThinkR-open/golem/blob/dev/R/add_modules.R#L60 |
Happens with :
-> Error (should be avoid)
|
> library(golem)
> for (fun in list(
+ add_rstudioconnect_file,
+ add_shinyappsio_file,
+ add_shinyserver_file
+ )){
+ for (i in 1:5){
+ fun(open = FALSE)
+ cat("File size: ", fs::file_info("app.R")$size, "\n")
+ }
+
+ }
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/app.R
File size: 302
>
> for(i in 1:5){
+ golem::add_module( name = "del_module", open = FALSE)
+ cat("File size: ", fs::file_info("R/mod_del_module.R")$size, "\n")
+ }
✓ File already exists.
● Go to R/mod_del_module.R
File size: 541
✓ File already exists.
● Go to R/mod_del_module.R
File size: 541
✓ File already exists.
● Go to R/mod_del_module.R
File size: 541
✓ File already exists.
● Go to R/mod_del_module.R
File size: 541
✓ File already exists.
● Go to R/mod_del_module.R
File size: 541
>
>
> for (fun in list(
+ add_js_handler,
+ add_js_file
+ )){
+ for(i in 1:5){
+ fun("d", open = FALSE)
+ cat("File size: ",
+ fs::file_info("inst/app/www/d.js")$size, "\n")
+ }
+ }
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100
✓ File already exists.
● Go to /Users/colin/Seafile/documents_colin/R/trash/testGolem/inst/app/www/d.js
File size: 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Calling one of the helper functions to create a module, function or utils
golem::add_*
when the file already exist appends an empty template to the bottom.Should probably warn user file already exists.
Quick illustration:
The text was updated successfully, but these errors were encountered: