From 7db127e1b11f4dca9e57fab6d5acf82b91c59522 Mon Sep 17 00:00:00 2001 From: "dyfan.jones" Date: Mon, 11 Sep 2023 09:44:50 +0100 Subject: [PATCH] remove archive to reduce space --- archive/create_pr.sh | 7 -- archive/docs.R | 188 ------------------------------------------ archive/docs.sh | 27 ------ archive/get_version.R | 9 -- archive/index.html | 99 ---------------------- archive/pkgdown.yml | 5 -- archive/styles.css | 167 ------------------------------------- 7 files changed, 502 deletions(-) delete mode 100644 archive/create_pr.sh delete mode 100644 archive/docs.R delete mode 100644 archive/docs.sh delete mode 100644 archive/get_version.R delete mode 100644 archive/index.html delete mode 100644 archive/pkgdown.yml delete mode 100644 archive/styles.css diff --git a/archive/create_pr.sh b/archive/create_pr.sh deleted file mode 100644 index 9db8fcb8ac..0000000000 --- a/archive/create_pr.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -version=$(Rscript get_version.R) -pr_title="Regenerate Paws Website: ${version}" -pr_body="Regenerate Paws SDK Website: ${version}" - -gh pr create --title "${pr_title}" --body "${pr_body}" diff --git a/archive/docs.R b/archive/docs.R deleted file mode 100644 index bf79e3b80e..0000000000 --- a/archive/docs.R +++ /dev/null @@ -1,188 +0,0 @@ -library(optparse) - -option_list <- list( - make_option(c("--docs"), - action = "store_true", default = FALSE, - help = "Generate all the documentation" - ), - make_option(c("--combine"), - action = "store_true", default = FALSE, - help = "Combine documentation together" - ), - make_option(c("--index"), - action = "store_true", default = FALSE, - dest = "index", help = "Get the index for the CRAN version of Paws." - ), - make_option(c("--topics"), - action = "store_true", default = FALSE, - dest = "topics", help = "Create Paws Topics." - ), - make_option("--file", - default = "", type = "character", help = "Topic file to build Paws website." - ) -) - -# get command line options -opt <- parse_args(OptionParser(option_list=option_list)) - -# Convert a filename from R documentation to output path -# e.g. acm_list_certificates.Rd -> acm/list_certificates.Rd -get_paths <- function(x) { - base <- basename(x) - service <- gsub("^([^_]+)_(.*)", "\\1", base) - file <- gsub("^([^_]+)_(.*)", "\\2", base) - - # Service index pages, e.g. acm.html for ACM. - index <- !grepl("_", base) - service <- ifelse(index, tools::file_path_sans_ext(base), service) - file <- ifelse(index, "index.html", file) - - result <- file.path(service, file) - return(result) -} - -paws_build_reference <- function(pkg = ".", - seed = 1014, - override = list(), - topics = NULL) { - pkg <- pkgdown:::section_init(pkg, depth = 1L, override = override) - - pkgdown:::rule("Building function reference") - # build_reference_index(pkg) - - pkgdown:::copy_figures(pkg) - - if (!is.null(topics)) { - topics <- purrr::transpose(pkg$topics[pkg$topics$name %in% topics, ]) - } else { - topics <- purrr::transpose(pkg$topics) - } - - purrr::map(topics, - pkgdown:::build_reference_topic, - pkg = pkg, - lazy = FALSE, - examples_env = NULL, - run_dont_run = FALSE - ) -} - -write_topics <- function(src, n = 10) { - topics <- list.files(file.path(src, "man")) - topics <- gsub(".Rd", "", topics) - topics <- split(topics, seq_along(topics)%%n) - dir.create("topics", showWarnings = F) - lapply(1:n, function(x){ - base::writeLines(topics[[x]], sprintf("topics/topics_prt%s.txt", x)) - }) -} - - read_topics <- function(src = "") { - if(!nzchar(src)){ - return(NULL) - } - if (!file.exists(src)) { - return(NULL) - } - return(base::readLines(src)) -} - -initial_index <- function(src, dst){ - pkg <- pkgdown:::section_init(normalizePath(src), depth = 0, override = list()) - dir.create(dst, showWarnings = F) - - pkg$dst_path <- normalizePath(dst) - pkg$topics$file_out <- get_paths(pkg$topics$file_out) - - file.create(file.path(pkg$dst_path, "pkgdown.yml")) - for (dir in unique(dirname(pkg$topics$file_out))) { - path_out <- file.path(pkg$dst_path, "reference", dir) - dir.create(path_out, showWarnings = FALSE, recursive = TRUE) - } - - pkgdown:::rule("Building pkgdown site", line = 2) - pkgdown:::cat_line("Reading from: ", pkgdown:::src_path(pkgdown:::path_abs(pkg$src_path))) - pkgdown:::cat_line("Writing to: ", pkgdown:::dst_path(pkgdown:::path_abs(pkg$dst_path))) - pkgdown:::init_site(pkg) - pkgdown:::build_reference_index(pkg) -} - - -build_site <- function (src, dst, topics = NULL, index = FALSE) { - attach(loadNamespace("pkgdown"), name = "pkgdown_all") - pkg <- section_init(normalizePath(src), depth = 0, override = list()) - - pkg$dst_path <- normalizePath(dst) - pkg$topics$file_out <- get_paths(pkg$topics$file_out) - - # unlink(pkg$dst_path, recursive = TRUE, force = TRUE) - dir.create(pkg$dst_path, showWarnings = FALSE) - file.create(file.path(pkg$dst_path, "pkgdown.yml")) - for (dir in unique(dirname(pkg$topics$file_out))) { - path_out <- file.path(pkg$dst_path, "reference", dir) - dir.create(path_out, showWarnings = FALSE, recursive = TRUE) - } - - rule("Building pkgdown site", line = 2) - cat_line("Reading from: ", src_path(path_abs(pkg$src_path))) - cat_line("Writing to: ", dst_path(path_abs(pkg$dst_path))) - init_site(pkg) - if (!index) { - paws_build_reference(pkg, seed = 1014, override = list(), topics = topics) - } else { - build_reference_index(pkg) - } - detach("pkgdown_all") -} - -combine_docs <- function(src, dest) { - dir_ls <- list.dirs(src, full.names = T,recursive = F) - file_ls_src <- unlist( - lapply(dir_ls, function(dir) { - list.files(dir, recursive = T, all.files = T, full.names = T) - }), - recursive = F - ) - m <- regexpr(paste0(dest,".*"), file_ls_src) - file_ls_dest <- regmatches(file_ls_src, m) - - lapply(unique(dirname(file_ls_dest)), dir.create, showWarnings = F, recursive = T) - lapply(seq_along(file_ls_src), function(i) { - file.copy( - file_ls_src[i], file_ls_dest[i] - ) - }) -} - -if (opt$topics){ - # Generate all the documentation. - docs_dir <- "vendor/paws/paws" - roxygen2::update_collate(docs_dir) - roxygen2::roxygenise(docs_dir, roclets = c("rd")) - initial_index(docs_dir, "./docs") - write_topics(docs_dir) -} - -if (opt$docs) { - docs_dir <- "vendor/paws/paws" - if (!file.exists(docs_dir)) { - docs_dir <- file.path("temp", docs_dir) - } - build_site(docs_dir, "./docs", topics = read_topics(opt$file)) -} - -if (opt$combine) { - combine_docs("temp", "docs") -} - -if (opt$index) { - # Get the index for the CRAN version of Paws. - dir <- tempdir() - paws_dir <- "vendor/paws/cran/paws" - if (!file.exists(paws_dir)) { - paws_dir <- file.path("temp", paws_dir) - } - build_site(paws_dir, dir, index = TRUE) - # Copy the CRAN index. - file.copy(file.path(dir, "reference/index.html"), "./docs/reference", overwrite = TRUE) -} diff --git a/archive/docs.sh b/archive/docs.sh deleted file mode 100644 index b5f6be5a40..0000000000 --- a/archive/docs.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Check if the 'docs/reference' folder exists. If not, exit. -if [ ! -d "docs/reference" ]; then - exit 1 -fi - -# Move files from 'docs/reference' to 'docs' and fix paths to included CSS and JS. -mv docs/reference/* docs -rmdir docs/reference -find docs -name "*.html" -exec sed -i.bkp -E 's/(href|src)="\.\.\/([^"]*)"/href="\2"/g' {} + - -# Delete Reference and Changelog from the navbar. -find docs -name "*.html" -exec sed -i.bkp -E '/(reference|news)\/index.html/d' {} + - -# In each service's index, replace links to 'xxx_yyy.html' with links to 'yyy.html'. -find docs -name "index.html" -exec sed -i.bkp -E 's/href="([a-zA-Z0-9]+)_([a-zA-Z0-9_]+).html"/href="\2.html"/g' {} + - -# Replace links to 'xxx/index.html' with links to 'xxx'. -find docs -name "*.html" -exec sed -i.bkp -E 's/href="(.+)\/index.html"/href="\1"/g' {} + - -# Delete 'NOT RUN' lines in examples. -find docs -name "*.html" -exec sed -i.bkp -E 's/(# NOT RUN \{|# \})//g' {} + - -# Delete empty comment lines in examples. -find docs -name "*.html" -exec perl -i.bkp -p0e "s/\n?<\/span>\n?//g" {} + -find docs -name "*.bkp" -exec rm {} + diff --git a/archive/get_version.R b/archive/get_version.R deleted file mode 100644 index 363fa8f706..0000000000 --- a/archive/get_version.R +++ /dev/null @@ -1,9 +0,0 @@ -description <- "vendor/paws/cran/paws/DESCRIPTION" -if (!file.exists(description)) { - description <- file.path("temp", description) -} -desc <- readLines(description) -version <- desc[grepl("Version:*.[0-9]+\\.[0-9]+\\.[0-9]+", desc)] -pattern <- "[0-9]+\\.[0-9]+\\.[0-9]+" -m <- regexpr(pattern, version) -cat(regmatches(version, m)) diff --git a/archive/index.html b/archive/index.html deleted file mode 100644 index 94a34c1484..0000000000 --- a/archive/index.html +++ /dev/null @@ -1,99 +0,0 @@ - - - Paws: R Package for Amazon Web Services - - - - - - - - - - - - - -
- - - - - -
- - diff --git a/archive/pkgdown.yml b/archive/pkgdown.yml deleted file mode 100644 index 06304c075b..0000000000 --- a/archive/pkgdown.yml +++ /dev/null @@ -1,5 +0,0 @@ -pandoc: '2.6' -pkgdown: 1.3.0 -pkgdown_sha: ~ -articles: [] - diff --git a/archive/styles.css b/archive/styles.css deleted file mode 100644 index e061f99222..0000000000 --- a/archive/styles.css +++ /dev/null @@ -1,167 +0,0 @@ -body { - margin: 0; - background-color: #fff; -} - -/* -------------------------------------------------------------------------- */ - -.wrapper { - display: grid; - grid-template-columns: 200px 1fr; - height: 100%; - font-family: 'Bungee', cursive; - font-size: 1.5em; - line-height: 1.5em; - color: #3f4652; -} - -.wrapper a { - color: #3f4652; - text-decoration: none; -} - -.wrapper a:hover { - text-decoration: underline; -} - -/* -------------------------------------------------------------------------- */ - -.sidebar { - padding: 1em; -} - -.sidebar .header { - position: absolute; - margin-top: 25px; - margin-left: 8px; - font-size: 3.85em; -} - -.sidebar .subtitle-wrapper { - text-align: center; -} - -.sidebar .subtitle { - display: inline-block; - text-align: left; - margin-top: 5em; -} - -.sidebar .highlight::first-letter { - color: #ff9900; -} - -.sidebar nav { - margin-top: 2em; - text-align: center; -} - -.sidebar nav a { - background-color: #007bff; - border: 1px solid transparent; - border-radius: 0.25em; - color: #fff; - display: inline-block; - font-family: apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; - font-size: 16px; - font-weight: 500; - line-height: 1.5; - margin-bottom: 1em; - padding: .3rem 0.5rem 0.5rem; - text-align: center; - width: 50%; -} - -.sidebar nav a:hover { - background-color: #0069d9; -} - -/* -------------------------------------------------------------------------- */ - -.content { - display: grid; - grid-template-columns: 400px 400px 1fr; - grid-template-rows: 1fr 40px; - background-color: #b7c9e8; -} - -.content .left { - padding: 5.5em 1em 1em 1em; -} - -.content .right { - padding: 0; - text-align: center; -} - -.speech-bubble-wrapper { - display: inline-block; - margin: 0.5em 0; -} - -/* Source: https://leaverou.github.io/bubbly/ */ -.speech-bubble { - position: relative; - background: #fff; - border-radius: 0.75em; - padding: 0.5em 1em; -} - -.speech-bubble:after { - content: ''; - position: absolute; - right: 0; - top: 50%; - width: 0; - height: 0; - border: 24px solid transparent; - border-left-color: #fff; - border-right: 0; - border-top: 0; - margin-top: -12px; - margin-right: -24px; -} - -.content li { - margin-bottom: 0.7em; -} - -.content li i { - color: #fff; -} - -.content img { - max-width: 275px; - height: auto; - margin: 1em 0; -} - -.content .code-bubble { - background: #fff; - border-radius: 0.5em; - margin: 0.5em 0.2em; - padding: 0.25em 0.5em; - line-height: 1.25em; - text-align: left; -} - -.content code { - font-family: 'Inconsolata', monospace; - font-size: 16px; - font-weight: 700; -} - -.content code .highlight { - color: #5392ff; -} - -.content .note { - font-size: 0.75em; -} - -.content .footer { - grid-column: 1 / 3; - font-family: sans-serif; - font-size: 12px; - text-align: center; -} \ No newline at end of file