Skip to content

Commit

Permalink
raymolecule v0.5.3: Add pkgdown helper function to only run some code…
Browse files Browse the repository at this point in the history
… in pkgdown during CRAN check
  • Loading branch information
tylermorganwall committed Feb 19, 2024
1 parent 54b6619 commit d10698c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: raymolecule
Type: Package
Title: Parse and Render Molecular Structures in 3D
Version: 0.5.2
Version: 0.5.3
Date: 2024-2-18
Authors@R: c(person("Tyler", "Morgan-Wall", email = "[email protected]",
role = c("aut", "cph", "cre"), comment = c(ORCID = "0000-0002-3131-3814")))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export(get_molecule)
export(read_pdb)
export(read_sdf)
export(render_model)
export(run_documentation)
importFrom(magrittr,"%>%")
importFrom(rayrender,add_object)
importFrom(rayrender,glossy)
Expand Down
17 changes: 11 additions & 6 deletions R/get_molecule.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,33 @@
#' @export
#'
#' @examples
#' \donttest{
#' if(run_documentation()) {
#' get_molecule("caffeine") %>%
#' generate_full_scene() %>%
#' render_model()
#'
#' }
#' if(run_documentation()) {
#' #estradiol (aka estrogen)
#' get_molecule(5757) %>%
#' generate_full_scene() %>%
#' render_model()
#'
#' }
#' if(run_documentation()) {
#' get_molecule("testosterone") %>%
#' generate_full_scene() %>%
#' render_model()
#'
#' }
#' if(run_documentation()) {
#' get_molecule("aspirin") %>%
#' generate_full_scene() %>%
#' render_model()
#'
#' }
#' if(run_documentation()) {
#' get_molecule("rutoside") %>%
#' generate_full_scene() %>%
#' render_model()
#'
#' }
#' if(run_documentation()) {
#' #If the 3D SDF doesn't exist, this function will pull the 2D SDF and inform the user
#' get_molecule("cyanocobalamin") %>%
#' generate_full_scene() %>%
Expand Down
13 changes: 13 additions & 0 deletions R/run_documentation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#' @title Run Documentation
#'
#' @description This function determines if the examples are being run in pkgdown. It is not meant to be called by the user.
#'
#' @export
#'
#' @return Boolean value.
#' @examples
#' # See if the documentation should be run.
#' run_documentation()
run_documentation = function() {
return(identical(Sys.getenv("IN_PKGDOWN"), "true"))
}
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ reference:
desc: "Function to get included example data."
contents:
- starts_with("get")
- title: "pkgdown utils"
desc: "Internal but must be exported to meet CRAN guidelines"
contents:
- starts_with("run")

navbar:
title: "raymolecule"
Expand Down
17 changes: 11 additions & 6 deletions man/get_molecule.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions man/run_documentation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d10698c

Please sign in to comment.