gen_runtime_description(
  c("dplyr", 
    "sparklyr (>= 0.7.0-9020)", 
    "pool (>= 0.1.4)"),
  github = c("rstudio/pool", "rstudio/sparklyr")
)
library(pkglock)
pkgs <- c("dplyr", "ggplot2 (>= 2.2.1.9000)", "purrr", "PKPDmisc")
runtime_desc <- gen_runtime_description(
  pkgs,
  github = c("tidyverse/ggplot2"),
  name = "Devin Pastoor",
  email = "devin.pastoor@gmail.com"
)
# setup install requirements
withr::with_libpaths("/Users/devin/clients/amgen/pkglock/inst/installreq",
                     {
                       install.packages("devtools")
                       install.packages("packrat")
                     }
                     )

using package functions

tmpdir <- "tmp"
new_snap <- install_from_desc(runtime_desc, .dir = tmpdir, .install = FALSE)
new_snap$pkglibpath
new_snap$snapshot$tardir

here should probably copy both the binaries (optimization) and the tarballs (req) into the new runtime template. The binaries may be in other libs on the system.

rtdir <- setup_runtime_template(new_snap$snapshot$lockfile, .dir = tmpdir)
## copy over tars + binaries at least in the libpath

fs::dir_copy(new_snap$snapshot$tardir, fs::path(rtdir, "packrat"))
# if going to do this, will need to get the full platform spec correct
# eg x86_64-apple-darwin16.7.0/3.4.3/<libs>
new_binary_dir <- fs::path(rtdir, 
          "packrat", 
          "lib", 
          R.version$platform)
fs::dir_create(new_binary_dir)

fs::dir_copy(new_snap$pkglibpath, new_binary_dir) 
# is there a way to copy the contents of a dir with renaming

file.rename(fs::path(new_binary_dir, "pkglib"), fs::path(new_binary_dir, getRversion()))
binary_runtime <- install_runtime(rtdir)
.libPaths()


dpastoor/pkglock documentation built on May 7, 2019, 8:24 a.m.