Skip to content

Commit

Permalink
update vignette with short sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
parmsam-pfizer committed Sep 25, 2023
1 parent 86b0ce0 commit 634e5da
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions vignettes/generate-lockfile.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ library(dplyr)
library(renv)
```

Axecute a script and get the logfile.

```{r run-axecute, echo = FALSE}
```{r run_axecute, echo = FALSE}
scriptPath <- tempfile()
logDir <- tempdir()
Expand All @@ -40,33 +41,31 @@ writeLines(
filePath <- file.path(logDir, "log_out_parse")
axecute(scriptPath, log_name = "log_out_parse", log_path = logDir)
parsedFile <- read_log_file(filePath)
```

Later on read (and parse) previous log file as list of objects.

```{r read-previous-logfile}
# check that the log file can be parsed
parsedFile$`Used Package and Functions`
```{r read_logfile}
parsedFile <- read_log_file(filePath)
```

```{r lockfile}
Create a renv lockfile based on the used packages mentioned in the logfile.

```{r gen_lockfile}
used_pgks <- parsedFile$`Used Package and Functions` %>%
transmute(package_name = str_extract(library, "(?<=package\\:).+"))
temp_lockfile <- tempfile(fileext = ".lockfile")
x <- renv::lockfile_create(
type = "custom",
packages = used_pgks
packages = used_pgks$package_name
)
renv::lockfile_write(
lockfile = x,
file = temp_lockfile,
type = "custom",
)
readlines(temp_lockfile)
```

0 comments on commit 634e5da

Please sign in to comment.