knitr::opts_chunk$set(message = FALSE, warning = FALSE)

All rOpenSci packages via GitHub API:

# remotes::install_github("r-pkgs/gh")
library("gh")

repos <- gh("/users/:username/repos", username = "ropensci", .limit = Inf)
repo_names <- vapply(repos, "[[", "", "name")
#not_a_pkg <- grepl("[-_]", repo_names)
#pkgs <- repo_names[!not_a_pkg]
writeLines(paste("ropensci", repo_names, sep="/"), "ropensci_gh.txt")

## Clone all, check for which ones have DESCRIPTION files

All rOpenSci packages via ropkgs:

#remotes::install_github("ropensci/ropkgs")
library("ropkgs")
out <- ro_pkgs()
good <- out$packages$status == "good"
installable <- out$packages$installable

pkgs <- gsub("https://github.com/", "", out$packages$url)[installable & good]
#pkgs <- pkgs[1:3]
dir.create("pkg_src"); 
setwd("pkg_src")
for(p in pkgs){
  system(paste0("git clone https://github.com/", p, " ", p))
}
setwd("pkg_src") # setwd doesn't persist across chunks
cm <- lapply(pkgs, function(p){
  message(p)
  codemetar::create_codemeta(p)
})
codemetar::write_codemeta(cm, path="ropensci.json")


codemeta/codemetar documentation built on Feb. 21, 2024, 3:27 p.m.