diff --git a/README.md b/README.md deleted file mode 100644 index c6fcea6..0000000 --- a/README.md +++ /dev/null @@ -1,14 +0,0 @@ -animint2 gallery - -Instructions for contribution: - -* First `remotes::install_github("animint/animint2@84-move-gallery-from-blocks-to-gh-pages")` to get the most recent code with support for the `source` option. -* Create a data `viz` object with options: - * `title` string describing the data viz, - * `source` URL of data viz source code. -* In R, run `animint2pages(viz,"new_github_repo")` to create a new - GitHub repo with your viz deployed in the gh-pages branch. -* Add a `Capture.PNG` file (screenshot of data viz) to the gh-pages - branch of that repo. -* Add `your_github_username/new_github_repo` on a new line in - [repos.txt](repos.txt). diff --git a/repos.R b/repos.R deleted file mode 100644 index f2f2722..0000000 --- a/repos.R +++ /dev/null @@ -1,55 +0,0 @@ -library(data.table) -gh_pages <- tempfile() -gert::git_clone(".", gh_pages) -gert::git_branch_checkout("gh-pages", repo=gh_pages) -get_repo_row <- function(repo){ - viz_dir <- tempfile() - origin_url <- paste0("https://github.com/", repo, ".git") - gert::git_clone(origin_url, viz_dir) - gert::git_branch_checkout("gh-pages", repo=viz_dir) - Capture.PNG <- file.path(viz_dir, "Capture.PNG") - if(!file.exists(Capture.PNG)){ - stop(sprintf("gh-pages branch of %s should contain file named Capture.PNG (screenshot of data viz)", repo)) - } - repo.png <- sprintf("repos/%s.png", repo) - user.dir <- dirname(repo.png) - dir.create(user.dir, showWarnings = FALSE, recursive = TRUE) - file.copy(Capture.PNG, repo.png) - gert::git_add(Capture.PNG, ".") - plot.json <- file.path(viz_dir, "plot.json") - jlist <- RJSONIO::fromJSON(plot.json) - commit.row <- gert::git_log(max=1, repo=viz_dir) - repo.row <- data.table( - repo, commit.POSIXct=commit.row$time) - to.check <- c( - source="URL of data viz source code", - title="string describing the data viz") - for(attr.name in names(to.check)){ - attr.value <- jlist[[attr.name]] - if( - is.character(attr.value) - && length(attr.value)==1 - && !is.na(attr.value) - && nchar(attr.value)>0 - ){ - set(repo.row, j=attr.name, value=attr.value) - }else{ - stop(sprintf("plot.json file in gh-pages branch of %s should have element named %s which should be %s", repo, attr.name, to.check[[attr.name]])) - } - } - repo.row -} -repos.dt <- fread("repos.txt",header=FALSE,col.names="repo") -meta.dt.list <- list() -error.dt.list <- list() -add.POSIXct <- Sys.time() -for(repo in repos.dt$repo){ - tryCatch({ - meta.dt.list[[repo]] <- data.table(add.POSIXct, get_repo_row(repo)) - }, error=function(e){ - error.dt.list[[repo]] <<- data.table(add.POSIXct, repo, error=e$message) - }) -} -(meta.dt <- rbindlist(meta.dt.list)) -(error.dt <- rbindlist(error.dt.list)) - diff --git a/repos.txt b/repos.txt deleted file mode 100644 index 768fc6a..0000000 --- a/repos.txt +++ /dev/null @@ -1,3 +0,0 @@ -tdhock/tdhock-figure-nnet-regression-degrees -tdhock/animint-figure-nnet-regression-degrees -tdhock/necromass-figure-one-network