Skip to content

Commit

Permalink
Option to turn on / off installation after build.
Browse files Browse the repository at this point in the history
Fix #38
  • Loading branch information
gfinak committed Jul 31, 2018
1 parent 2462abf commit 1825fad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' @param vignettes \code{logical} specify whether to build vignettes. Default FALSE.
#' @param log log level \code{INFO,WARN,DEBUG,FATAL}
#' @param deps \code{logical} should we pass data objects into subsequent scripts? Default TRUE
#' @param install \code{logical} automatically install and load the package after building. (default TRUE)
#' @importFrom roxygen2 roxygenise roxygenize
#' @importFrom devtools build_vignettes build parse_deps reload
#' @importFrom usethis use_build_ignore use_rstudio proj_set use_directory
Expand Down Expand Up @@ -35,7 +36,8 @@
package_build <- function(packageName = NULL,
vignettes = FALSE,
log = INFO,
deps = TRUE) {
deps = TRUE,
install = TRUE) {
flog.threshold(log)
flog.appender(appender.console())
# requireNamespace("futile.logger")
Expand Down Expand Up @@ -89,8 +91,10 @@ package_build <- function(packageName = NULL,
vignettes = vignettes
)
# try to install and then reload the package in the current session
install.packages(location,repos = NULL, type = "source")
devtools::reload(package_path)
if (install) {
install.packages(location,repos = NULL, type = "source")
devtools::reload(package_path)
}
return(location)
}

Expand Down
4 changes: 3 additions & 1 deletion man/package_build.Rd

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

0 comments on commit 1825fad

Please sign in to comment.