Skip to content

Commit

Permalink
Site deployment changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneplusplus committed Dec 18, 2021
1 parent 6080b46 commit 976895a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
16 changes: 8 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: listdown
Title: Create R Markdown from Lists
Version: 0.4.6
Version: 0.4.7
Authors@R: c(
person("Michael J.", "Kane",
role = c("aut", "cph", "cre"),
Expand All @@ -18,15 +18,15 @@ Imports:
yaml,
fs
Suggests:
DT,
ggplot2,
testthat,
purrr,
knitr,
covr
DT,
ggplot2,
testthat,
purrr,
knitr,
covr
Enhances:
workflowr
URL: https://github.com/kaneplusplus/listdown
BugReports: https://github.com/kaneplusplus/listdown/issues
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
VignetteBuilder: knitr
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ importFrom(rmarkdown,render_site)
importFrom(stats,na.omit)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tools,file_path_as_absolute)
importFrom(utils,browseURL)
importFrom(utils,tail)
importFrom(yaml,as.yaml)
Expand Down
18 changes: 11 additions & 7 deletions R/build-site.r
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,19 @@ make_dirs_as_needed <- function(dir_paths) {
#' @importFrom checkmate assert check_character check_list
#' @importFrom tibble tibble as_tibble
#' @importFrom rmarkdown render_site
#' @importFrom tools file_path_as_absolute
#' @importFrom yaml write_yaml
#' @importFrom stats na.omit
#' @importFrom fs path_rel
#' @importFrom utils browseURL
#' @export
ld_build_html_site <-
function(
doc_bundles,
site_yaml,
rmd_dir = file.path(tempdir(), "rmarkdown"),
data_dir = file.path("..", "data"),
html_dir = file.path("..", "html"),
site_dir = tempdir(),
rmd_dir = file.path(site_dir, "rmarkdown"),
data_dir = file.path(site_dir, "data"),
html_dir = file.path(site_dir, "html"),
render_site = TRUE,
view = interactive(),
make_data_dir = TRUE,
Expand All @@ -231,7 +232,7 @@ ld_build_html_site <-
)

if (make_data_dir) {
make_dirs_as_needed(file.path(rmd_dir, data_dir))
make_dirs_as_needed(data_dir)
}
if (make_rmd_dir) {
make_dirs_as_needed(rmd_dir)
Expand Down Expand Up @@ -277,6 +278,9 @@ ld_build_html_site <-
doc_bundles <- doc_bundles[-unnamed_id]
}
bundles <- tibble(name = names(doc_bundles), bundle = doc_bundles)
if ( !("name" %in% names(bundles)) ) {
bundles$name <- out_fns$name
}
bundles <- as_tibble(merge(bundles, out_fns, by = "name", all = TRUE))
bundles$rds<- paste0(remove_file_extension(bundles$rmd), ".rds")
if (nrow(bundles) != nrow(na.omit(bundles))) {
Expand All @@ -288,7 +292,7 @@ ld_build_html_site <-
rmd_file_name = bundles$rmd[i],
cc_file_name = bundles$rds[i],
rmd_dir = rmd_dir,
data_dir = data_dir[recycle(i, length(rmd_dir))],
data_dir = path_rel(data_dir[recycle(i, length(rmd_dir))], rmd_dir),
output_dir = html_dir,
render_doc = FALSE)
}
Expand All @@ -299,7 +303,7 @@ ld_build_html_site <-
browseURL(file.path(rmd_dir, html_dir, "index.html"))
}
}
file_path_as_absolute(file.path(rmd_dir, html_dir, "index.html"))
normalizePath(file.path(html_dir, "index.html"), mustWork = FALSE)
}

#' @importFrom checkmate check_numeric
Expand Down
7 changes: 4 additions & 3 deletions man/ld_build_html_site.Rd

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

0 comments on commit 976895a

Please sign in to comment.