electricShine

library(electricShine)
electricShine::electrify(
  app_name = "Cerebro",
  short_description = "Cerebro",
  semantic_version = "1.3.0",
  build_path = '~/Research/test_electric_shine/',
  cran_like_url = "https://cran.r-project.org",
  function_name = "launchCerebro",
  local_package_path = "/Users/romanhaa/Research/GitHub/cerebroApp_v1.3",
  package_install_opts = list(type = c("source")),
  mac_url = "https://mac.r-project.org/high-sierra/R-4.0-branch/x86_64/R-4.0-branch.tar.gz"
)
app_name <- "Cerebro"
app_version <- "1.3.0"
app_dir <- "~/Research/test_electric_shine/Cerebro"
nodejs_version <- "v12.16.2"

## get OS
os <- electricShine::get_os()

## create app folder
create_folder(app_dir)

## copy app template
copy_template(app_dir)

## install R
install_r(
  cran_like_url = NULL,
  app_root_path = app_dir,
  mac_url = "https://mac.r-project.org/high-sierra/R-4.0-branch/x86_64/R-4.0-branch.tar.gz",
  permission_to_install = FALSE
)

## remove unnecessary files
trim_r(app_dir)

## set library path
library_path <- file.path(app_dir, "app/r_lang/Library/Frameworks/R.framework/Versions")
library_path <- list.dirs(library_path, recursive = FALSE)
library_path <- library_path[grep("\\d+\\.(?:\\d+|x)(?:\\.\\d+|x){0,1}", library_path)][[1]]
library_path <- file.path(library_path, "Resources/library", fsep = "/")

## install cerebroApp
my_package_name <- install_user_app(
  library_path = library_path,
  repo_location = "local",
  repo = "~/Research/GitHub/cerebroApp_v1.3/",
  repos = "https://cran.r-project.org",
  package_install_opts = list(type = c("both"))
)

##
create_package_json(
  app_name = app_name,
  semantic_version = app_version,
  app_root_path = app_dir,
  description = "description"
)

##
modify_background_js(
  background_js_path = file.path(app_dir, "src", "background.js"),
  my_package_name = app_name,
  function_name = "launchCerebro",
  r_path = base::dirname(library_path)
)

##
nodejs_path <- install_nodejs(
  node_url = "https://nodejs.org/dist",
  nodejs_path = file.path(system.file(package = "electricShine"), "nodejs"),
  force_install = FALSE,
  nodejs_version = nodejs_version,
  permission_to_install = FALSE
)


run_build_release(
  nodejs_path = nodejs_path,
  app_path = app_dir,
  nodejs_version = nodejs_version
)


romanhaa/cerebroApp documentation built on Nov. 25, 2021, 5:29 p.m.