diff --git a/NAMESPACE b/NAMESPACE index 1e99920b5..154b960c1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -215,6 +215,7 @@ export(alpha) export(animint) export(animint2dir) export(animint2gist) +export(animint2pages) export(animintOutput) export(annotate) export(annotation_custom) diff --git a/R/z_pages.R b/R/z_pages.R index 95d4d34e6..3a2b11938 100644 --- a/R/z_pages.R +++ b/R/z_pages.R @@ -16,27 +16,22 @@ animint2pages <- function(plot.list, github_repo, commit_message = "Commit from ) } # The below are copied from `animint2gist` - vendor.path <- file.path(res$out.dir, "vendor") - vendor.files <- list.files(vendor.path) - vendor.path.files <- file.path(vendor.path, vendor.files) - copied <- file.copy(vendor.path.files, file.path(res$out.dir, vendor.files)) - file.remove(vendor.path.files) - file.remove(vendor.path) - # reflect script path in index.html to reflect the change in file structure - index.file <- file.path(res$out.dir, "index.html") - html <- readLines(index.file) - html <- gsub("vendor/", "", html) - cat(html, file = index.file, sep = "\n") + # but we don't need a flat file structure now ## Figure out which files to post. all.files <- Sys.glob(file.path(res$out.dir, "*")) all.file.info <- file.info(all.files) is.empty <- all.file.info$size == 0 is.tilde <- grepl("~$", all.files) - is.png <- grepl("[.]png$", all.files) is.ignored <- all.file.info$isdir | is.empty | is.tilde to.post <- all.files[!is.ignored] tmp_dir <- tempfile() + # check if the repo already exists on GH + gh_repos <- "/" + user_name + "/" + github_repo + repo_exists <- any(sapply(github_repo, function(x) x$name) == github_repo) + if(!repo_exists){ + gh("POST /user/repos", name = github_repo) + } repo <- git2r::repository(tmp_dir) # TODO: Take a screenshot and save as Capture.PNG.