R/r-hooks.R

# Call an action hook (indicating whether the action is running or not)
callHook <- function(project, action, running) {
  project <- normalizePath(project, winslash = '/')
  for (fun in getHooksList("packrat.onAction")) {
    if (is.character(fun))
      fun <- get(fun)
    try(fun(project, action, running))
  }
}

# The value for getHook can be a single function or a list of functions,
# This function ensures that the result can always be processed as a list
getHooksList <- function(name) {
  hooks <- getHook(name)
  if (!is.list(hooks))
    hooks <- list(hooks)
  hooks
}

Try the packrat package in your browser

Any scripts or data that you put into this service are public.

packrat documentation built on May 2, 2019, 6:24 a.m.