-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rename to backtesting, simplify * move out of articles and into dropdown
- Loading branch information
Showing
8 changed files
with
619 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: epipredict | ||
Title: Basic epidemiology forecasting methods | ||
Version: 0.1.2 | ||
Version: 0.1.3 | ||
Authors@R: c( | ||
person("Daniel J.", "McDonald", , "[email protected]", role = c("aut", "cre")), | ||
person("Ryan", "Tibshirani", , "[email protected]", role = "aut"), | ||
|
@@ -36,6 +36,7 @@ Imports: | |
ggplot2, | ||
glue, | ||
hardhat (>= 1.3.0), | ||
here, | ||
lifecycle, | ||
magrittr, | ||
recipes (>= 1.0.4), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Run with: Rscript pkgdown-watch.R | ||
# | ||
# Modifying this: https://gist.github.com/gadenbuie/d22e149e65591b91419e41ea5b2e0621 | ||
# - Removed docopts cli interface and various configs/features I didn't need. | ||
# - Sped up reference building by not running examples. | ||
# | ||
# Note that the `pattern` regex is case sensitive, so make sure your Rmd files | ||
# end in `.Rmd` and not `.rmd`. | ||
|
||
rlang::check_installed(c("pkgdown", "servr", "devtools", "here", "cli", "fs")) | ||
|
||
pkg <- pkgdown::as_pkgdown(".") | ||
|
||
servr::httw( | ||
dir = here::here("docs"), | ||
watch = here::here(), | ||
pattern = "[.](Rm?d|y?ml|s[ac]ss|css|js)$", | ||
handler = function(files) { | ||
devtools::load_all() | ||
|
||
files_rel <- fs::path_rel(files, start = getwd()) | ||
cli::cli_inform("{cli::col_yellow('Updated')} {.val {files_rel}}") | ||
|
||
articles <- grep("vignettes.+Rmd$", files, value = TRUE) | ||
|
||
if (length(articles) == 1) { | ||
name <- fs::path_ext_remove(fs::path_rel(articles, fs::path(pkg$src_path, "vignettes"))) | ||
pkgdown::build_article(name, pkg) | ||
} else if (length(articles) > 1) { | ||
pkgdown::build_articles(pkg, preview = FALSE) | ||
} | ||
|
||
refs <- grep("man.+R(m?d)?$", files, value = TRUE) | ||
if (length(refs)) { | ||
# TODO: This does not work for me, so I just run it manually. | ||
# pkgdown::build_reference(pkg, preview = FALSE, examples = FALSE, lazy = FALSE) | ||
} | ||
|
||
pkgdown <- grep("pkgdown", files, value = TRUE) | ||
if (length(pkgdown) && !pkgdown %in% c(articles, refs)) { | ||
pkgdown::init_site(pkg) | ||
} | ||
|
||
pkgdown_index <- grep("index[.]Rmd$", files_rel, value = TRUE) | ||
if (length(pkgdown_index)) { | ||
devtools::build_rmd(pkgdown_index) | ||
pkgdown::build_home(pkg) | ||
} | ||
|
||
readme <- grep("README[.]rmd$", files, value = TRUE, ignore.case = TRUE) | ||
if (length(readme)) { | ||
devtools::build_readme(".") | ||
pkgdown::build_home(pkg) | ||
} | ||
|
||
cli::cli_alert("Site rebuild done!") | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.html | ||
*_cache/ | ||
*.R | ||
!_common.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
knitr::opts_chunk$set( | ||
digits = 3, | ||
comment = "#>", | ||
collapse = TRUE, | ||
cache = TRUE, | ||
dev.args = list(bg = "transparent"), | ||
dpi = 300, | ||
cache.lazy = FALSE, | ||
out.width = "90%", | ||
fig.align = "center", | ||
fig.width = 9, | ||
fig.height = 6 | ||
) | ||
ggplot2::theme_set(ggplot2::theme_bw()) | ||
options( | ||
dplyr.print_min = 6, | ||
dplyr.print_max = 6, | ||
pillar.max_footer_lines = 2, | ||
pillar.min_chars = 15, | ||
stringr.view_n = 6, | ||
pillar.bold = TRUE, | ||
width = 77 | ||
) |
Oops, something went wrong.