Skip to content

Commit

Permalink
address quick suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kweav committed Jul 9, 2024
1 parent 23f0fa5 commit 0aabec8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions R/screenshot.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#' A function to make screenshots from an OTTR bookdown website
#' @description This function creates screenshots of course chapters that are stored in a created output directory
#' @param git_pat default is NULL; required argument; a Git secret
#' @param repo default is NULL; required argument; GitHub repository name, e.g., jhudsl/OTTR_Template
#' @param git_pat required argument; a Git secret -- see https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens for more info
#' @param repo required argument; GitHub repository name, e.g., jhudsl/OTTR_Template
#' @param output_dir default is "resources/chapt_screen_images"; Output directory where the chapter's screen images should be stored. For OTTR courses, don't change this unless you've changed the downstream functions accordingly.
#' @param base_url default is NULL; rendered bookdown URL where screenshots are taken from, if NULL, the function will use the repo_name and and git_pat to find the base_url
#' @return the file path for file where chapter urls are saved
#' @import cow
#' @import dplyr
#' @importFrom webshot2 webshot
#' @importFrom magrittr %>%
#' @importFrom rprojroot find_root has_dir
#' @author Candace Savonen
make_screenshots <- function(git_pat = NULL, repo = NULL, output_dir = "resources/chapt_screen_images", base_url = NULL){
#' @examples \dontrun{
#'
#' make_screenshots(Sys.getenv("secrets.GH_PAT"), "jhudsl/OTTR_Template")
#'
#' }
make_screenshots <- function(git_pat, repo, output_dir = "resources/chapt_screen_images", base_url = NULL){

# Find .git root directory
root_dir <- find_root(has_dir(".git"))
Expand Down Expand Up @@ -57,4 +63,6 @@ make_screenshots <- function(git_pat = NULL, repo = NULL, output_dir = "resource

message(paste("Image Chapter key written to: ", file.path(output_folder, "chapter_urls.tsv")))

return(file.path(output_folder, "chapter_urls.tsv"))

}

0 comments on commit 0aabec8

Please sign in to comment.