scripts/scrape_process.R

# load_all()
source("scripts/process_fns.R")

mods <- parse_scraped()
mods <- mod_cleanup(mods)

# look at base class lengths...
base_length <- unlist(lapply(mods, function(x) length(get_inherit(x$base_class))))
zero_length <- which(base_length == 0)
# Glyph, GMapOptions, MapOptions, Marker, Model, Viewable, ButtonLike
multi_length <- which(base_length > 1)
# used to be AbstractButton ButtonGroup but that's fixed
no_proto <- which(unlist(lapply(mods, function(x) x$json == "")))
nms <- setdiff(names(mods), unique(c(names(multi_length), names(no_proto), "Base")))

# test it out...
a <- mods[["HelpTool"]]
cat(get_class_string(a, mods))
cat(get_test_string(a, mods))

# generate model and test files
cat("## Generated by scripts/scrape_process.R -- do not edit\n\n", file = "R/bokeh_models.R")
cat("## Generated by scripts/scrape_process.R -- do not edit\n\ncontext(\"models\")
\n\n",
  file = "tests/testthat/test-models.R")

for (nm in nms) {
  message(nm)
  a <- mods[[nm]]
  cat(get_class_string(a, mods), file = "R/bokeh_models.R", append = TRUE)
  cat(get_test_string(a, mods), file = "tests/testthat/test-models.R", append = TRUE)
}

# test()
hafen/rbokeh-models documentation built on May 17, 2019, 2:23 p.m.