ATFutures / geoplumber

Serve geographic data from R and consume with scalable front end.
https://atfutures.github.io/geoplumber/
59 stars 7 forks source link

creating RStudio project prior to gp_create breaks gp_create #59

Closed silberzwiebel closed 5 years ago

silberzwiebel commented 5 years ago

From the README:

If you create an Rstudio project at /Users/ruser/my_app yourself, or an empty my_app directory, you can create a geoplumber app using: geoplumber::gp_create(".").

I created an RStudio project and wanted to create a geoplumber app on top of that but this fails with:

> gp_create(".")
/usr/lib
└── create-react-app@2.1.3 

Initializing project at: /my/working/dir/gp_app

The directory /my/working/dir/gp_app contains files that could conflict:

  .Rproj.user
  rstudioproject.Rproj

Either try using a new directory name, or remove the files listed above.
error in gp_create(".") : 
  Please refer to the npx create-react-app /my/working/dir/gp_app error above.

Doing it the other way round (first gp_create() then creating an RStudio project in that folder) works fine. It might be good enough to just change the README?

layik commented 5 years ago

Thanks @silberzwiebel. I am aware of this issue and I did leave it on purpose to be raised by someone. Here are two solutions for a list.files() == c('rstudioproject.Rproj', '.Rproj.user') check:

  1. Move them to tempdir() and back after creation
  2. Copy usethis::use_rstudio() function into geoplumber.

UPDATE: 3. Check and stop CRA if .Rproj is there, allow user to create basic Rproj (implemented in commits below)

If you have any other solutions, I am happy to consider them. At this stage, it looks like cleaner and safer to go with the second option.

I literally cannot find time to deal with issues I am aware of, so apologies there.

layik commented 5 years ago

Please reopen if need be. Thanks @silberzwiebel

layik commented 5 years ago

I think there is still some work to be done here.