Skip to content

Commit

Permalink
Merge branch '84-move-gallery-from-blocks-to-gh-pages' of https://git…
Browse files Browse the repository at this point in the history
…hub.com/tdhock/animint2 into 84-move-gallery-from-blocks-to-gh-pages
  • Loading branch information
Faye-yufan committed Jul 26, 2023
2 parents 7ec1334 + 1a980fd commit 885a1f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export(alpha)
export(animint)
export(animint2dir)
export(animint2gist)
export(animint2pages)
export(animintOutput)
export(annotate)
export(annotation_custom)
Expand Down
19 changes: 7 additions & 12 deletions R/z_pages.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 885a1f0

Please sign in to comment.