Skip to content

Commit

Permalink
options no to restart with updating dep
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Jan 24, 2020
1 parent 59aa311 commit f391e80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
18 changes: 11 additions & 7 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ rave_version <- function(){
}

#' @title Check and Install RAVE Dependencies
#' @param update_rave logical, whether to restart `RStudio` after installation
#' @param update_rave logical, whether to update RAVE
#' @param restart logical, whether to restart `RStudio` after installation
#' @export
check_dependencies <- function(update_rave = TRUE){
check_dependencies <- function(update_rave = TRUE, restart = TRUE){
cat2('Check package rutabaga - Plot Helpers', level = 'DEFAULT')
remotes::install_github('dipterix/rutabaga@develop', upgrade = FALSE, force = FALSE, quiet = TRUE)
cat2('Check package threeBrain - 3D Viewer', level = 'DEFAULT')
Expand All @@ -68,15 +69,18 @@ check_dependencies <- function(update_rave = TRUE){
if( update_rave ){
cat2('Check update RAVE', level = 'DEFAULT')
remotes::install_github('beauchamplab/rave', upgrade = FALSE, force = FALSE, quiet = TRUE)
cat2('Finished. Please restart session by \n\tRStudio > Session > Restart R',
cat2('Finished. If R does not restart correctly, please manually restart the session \n\tGo to task bar -> Session > Restart R',
level = 'INFO')
}

rm(list = ls(envir = globalenv()), envir = globalenv())
f = get0('.rs.restartR', envir = globalenv(), ifnotfound = NULL)
if(is.function(f)){
do.call(f, list('library("rave")'))
if(restart){
rm(list = ls(envir = globalenv()), envir = globalenv())
f = get0('.rs.restartR', envir = globalenv(), ifnotfound = NULL)
if(is.function(f)){
do.call(f, list('library("rave")'))
}
}

invisible()
}

Expand Down
6 changes: 4 additions & 2 deletions man/check_dependencies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f391e80

Please sign in to comment.