golem icon indicating copy to clipboard operation
golem copied to clipboard

[BUG]

Open campbead opened this issue 2 years ago • 2 comments

Describe the bug add_dockerfile_with_renv_shinyproxy() fails when working directory is not same as the golem project directory, even when supplying source_folder.

To Reproduce

  1. create a new golem project golem.dummy in folder DUMMY_FOLDER
  2. setwd("~")
  3. run golem::add_dockerfile_with_renv_shinyproxy(source_folder = DUMMY_FOLDER)

Expected behavior Expect to produce temporary deploy folder and files when using the source_folder flag. This works when the working directory is the same as DUMMY_FOLDER and running: golem::add_dockerfile_with_renv_shinyproxy(source_folder = DUMMY_FOLDER)

Screenshots Screenshot 2023-02-06 114112

campbead avatar Feb 05 '23 22:02 campbead

hi,

what was your getwd() when you tried this ?

VincentGuyader avatar Feb 06 '23 07:02 VincentGuyader

Here is a reprex :

colinfay@Colins-MBP ~ % cd /tmp 

colinfay@Colins-MBP /tmp % Rscript -e "golem::create_golem('pouet')"
── [.Rprofile] Sourcing user-wide rprofile ─────────────────────────────────────
── Checking package name ───────────────────────────────────────────────────────
✔ Valid package name
── Creating dir ────────────────────────────────────────────────────────────────
✔ Creating 'pouet/'
✔ Setting active project to '/private/tmp/pouet'
✔ Creating 'R/'
✔ Writing a sentinel file '.here'
• Build robust paths within your project via `here::here()`
• Learn more at <https://here.r-lib.org>
✔ Setting active project to '<no active project>'
File .here already exists in /private/tmp/pouet
✔ Created package directory
── Copying package skeleton ────────────────────────────────────────────────────
✔ Copied app skeleton
── Running project hook function ───────────────────────────────────────────────
✔ All set
✔ Setting active project to '/private/tmp/pouet'
── Done ────────────────────────────────────────────────────────────────────────
A new golem named pouet was created at pouet .
To continue working on your app, start editing the 01_start.R file.

colinfay@Colins-MBP /tmp % pwd
/tmp

colinfay@Colins-MBP /tmp % cd ~ 

colinfay@Colins-MBP ~ % Rscript -e "golem::add_dockerfile_with_renv_shinyproxy(source_folder = '/tmp/pouet')"
── [.Rprofile] Sourcing user-wide rprofile ─────────────────────────────────────
You set `document = TRUE` and you did not pass your own renv.lock file,
as a consequence {golem} will use `attachment::att_amend_desc()` to update your 
DESCRIPTION file before creating the renv.lock file

you can set `document = FALSE` to use your actual DESCRIPTION file,
or pass you own renv.lock to use, using the `lockfile` parameter

In any case be sure to have no Error or Warning at `devtools::check()`
Loading required namespace: rstudioapi
Updating pouet documentation
Setting `RoxygenNote` to "7.2.3"
ℹ Loading pouet
Writing NAMESPACE
Writing NAMESPACE
Writing run_app.Rd
ℹ Loading pouet
All required packages are installed
✔ create renv.lock at /var/folders/9w/zdlv83ws6csdjnfc5x819gtr0000gn/T/RtmpabnvVw/deploy/renv.lock.prod
The following package(s) will be updated in the lockfile:

# CRAN ===============================
- R6            [* -> 2.5.1]
- Rcpp          [* -> 1.0.10]
- attempt       [* -> 0.3.1]
- base64enc     [* -> 0.1-3]
- bslib         [* -> 0.4.2]
- cachem        [* -> 1.0.6]
- cli           [* -> 3.6.0]
- commonmark    [* -> 1.8.1]
- config        [* -> 0.3.1]
- crayon        [* -> 1.5.2]
- digest        [* -> 0.6.31]
- ellipsis      [* -> 0.3.2]
- fastmap       [* -> 1.1.0]
- fontawesome   [* -> 0.5.0]
- fs            [* -> 1.6.0]
- glue          [* -> 1.6.2]
- here          [* -> 1.0.1]
- htmltools     [* -> 0.5.4]
- httpuv        [* -> 1.6.8]
- jquerylib     [* -> 0.1.4]
- jsonlite      [* -> 1.8.4]
- later         [* -> 1.3.0]
- lifecycle     [* -> 1.0.3]
- magrittr      [* -> 2.0.3]
- memoise       [* -> 2.0.1]
- mime          [* -> 0.12]
- promises      [* -> 1.2.0.1]
- rappdirs      [* -> 0.3.3]
- remotes       [* -> 2.4.2]
- rlang         [* -> 1.0.6]
- rprojroot     [* -> 2.0.3]
- sass          [* -> 0.4.5]
- shiny         [* -> 1.7.4]
- sourcetools   [* -> 0.1.7-1]
- withr         [* -> 2.5.0]
- xtable        [* -> 1.8-4]
- yaml          [* -> 2.3.7]

# Local ==============================
- golem         [* -> 0.4.0]

The version of R recorded in the lockfile will be updated:
- R             [*] -> [4.2.2]

* Lockfile written to '/var/folders/9w/zdlv83ws6csdjnfc5x819gtr0000gn/T/RtmpabnvVw/deploy/renv.lock.prod'.
ℹ Please wait while we compute system requirements...
Fetching system dependencies for 38 package records.
✔ Done
Error in get_current_config(path) : 
  The golem-config.yml file doesn't exist.
Calls: <Anonymous> ... <Anonymous> -> get_golem_things -> get_current_config
Execution halted

ColinFay avatar Feb 06 '23 10:02 ColinFay

This seems to be ok with latest version of {golem} (0.5.0) https://github.com/ThinkR-open/golem/pull/1163:

colinfay@Colins-MBP golem % cd /tmp 

colinfay@Colins-MBP /tmp % Rscript -e "golem::create_golem('pouet')"
[...]
A new golem named pouet was created at pouet .
To continue working on your app, start editing the 01_start.R file.

colinfay@Colins-MBP /tmp % cd ~  

colinfay@Colins-MBP ~ % Rscript -e "golem::add_dockerfile_with_renv_shinyproxy(source_folder = '/tmp/pouet', output_dir='/tmp/pouetout')"

[...]
   
✔  /var/folders/9w/zdlv83ws6csdjnfc5x819gtr0000gn/T/RtmpSzx2bo/deploy/pouet_0.0.0.9000.tar.gz created.

colinfay@Colins-MBP ~ % ls /tmp/pouetout 
Dockerfile              Dockerfile_base         README                  pouet_0.0.0.9000.tar.gz renv.lock.prod

Feel free to comment if you still have this issue

ColinFay avatar Aug 08 '24 05:08 ColinFay