Skip to content

Commit

Permalink
fix: clean calls to package with single quote
Browse files Browse the repository at this point in the history
  • Loading branch information
statnmap committed Jan 23, 2024
1 parent 6906fdd commit 7376f11
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 23 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
4 changes: 2 additions & 2 deletions R/build_fusen_chunks.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# WARNING - Generated by {fusen} from dev/flat_addins.Rmd: do not edit by hand

#' Add `{fusen}` chunks
#' Add 'fusen' chunks
#'
#' Create `{fusen}` chunks inside your Rmd
#' Create 'fusen' chunks inside your Rmd
#'
#' @param function_name Name of the function to create.
#' If NULL (the default), the user will be prompted to enter it.
Expand Down
4 changes: 2 additions & 2 deletions R/init_share_on_github.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#' Initiate GitHub to share your package on a website
#'
#' This uses {pkgdown} to share the documentation of the package through GitHub Actions.
#' This uses 'pkgdown' to share the documentation of the package through GitHub Actions.
#' You may need to run `usethis::create_github_token()`, then `gitcreds::gitcreds_set()` before.
#'
#' @param ask Logical. `TRUE` (default) to ask the user to apply the instructions each time needed,
Expand All @@ -22,7 +22,7 @@
#' - Init continuous integration (CI)
#' + Check the package on Linux, Windows and MacOS
#' + Calculate code coverage. Note that you may need to connect to <https://about.codecov.io/> to see the results of the code coverage.
#' - Init continuous deployment (CD) of the {pkgdown} website documentation
#' - Init continuous deployment (CD) of the 'pkgdown' website documentation
#' - Commit and push to GitHub
#' - List remaining manual steps to make the website public
#'
Expand Down
4 changes: 2 additions & 2 deletions dev/flat_addins.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pkgload::load_all(export_all = FALSE)
# Add fusen chunk

```{r function, filename="build_fusen_chunks"}
#' Add `{fusen}` chunks
#' Add 'fusen' chunks
#'
#' Create `{fusen}` chunks inside your Rmd
#' Create 'fusen' chunks inside your Rmd
#'
#' @param function_name Name of the function to create.
#' If NULL (the default), the user will be prompted to enter it.
Expand Down
2 changes: 1 addition & 1 deletion dev/flat_history_core.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Deprecated. See `add_flat_template()` instead.
#' Choose `name` among the different templates available:
#'
#' - "full": the full template with a reproducible package to inflate directly. Default.
#' - "minimal": Minimal template to start a new package when you already know {fusen}.
#' - "minimal": Minimal template to start a new package when you already know 'fusen'.
#' - "additional": Template for an additional vignette, thus additional functions.
#' - "teaching": Template with a reproducible package, simpler than "full", but everything to
#' teach the minimal structure of a package.
Expand Down
4 changes: 2 additions & 2 deletions dev/flat_init_share_on_github.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fusen::inflate(flat_file = "dev/flat_full.Rmd", vignette_name = "Get started")
```{r function-init_share_on_github}
#' Initiate GitHub to share your package on a website
#'
#' This uses {pkgdown} to share the documentation of the package through GitHub Actions.
#' This uses 'pkgdown' to share the documentation of the package through GitHub Actions.
#' You may need to run `usethis::create_github_token()`, then `gitcreds::gitcreds_set()` before.
#'
#' @param ask Logical. `TRUE` (default) to ask the user to apply the instructions each time needed,
Expand All @@ -89,7 +89,7 @@ fusen::inflate(flat_file = "dev/flat_full.Rmd", vignette_name = "Get started")
#' - Init continuous integration (CI)
#' + Check the package on Linux, Windows and MacOS
#' + Calculate code coverage. Note that you may need to connect to <https://about.codecov.io/> to see the results of the code coverage.
#' - Init continuous deployment (CD) of the {pkgdown} website documentation
#' - Init continuous deployment (CD) of the 'pkgdown' website documentation
#' - Commit and push to GitHub
#' - List remaining manual steps to make the website public
#'
Expand Down
4 changes: 2 additions & 2 deletions man/add_fusen_chunks.Rd

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

4 changes: 2 additions & 2 deletions man/init_share_on_github.Rd

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

43 changes: 34 additions & 9 deletions tests/testthat/test-inflate-part2.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ for (pkgname in create_choices_test) {
skip_on_cran()
expect_true(length(check_out[["notes"]]) <= 1)
if (length(check_out[["notes"]]) == 1) {
expect_true(grepl("future file timestamps", check_out[["notes"]]))
note_expected <- grepl("future file timestamps", check_out[["notes"]])
expect_true(note_expected)
if (!note_expected) {
# Keep here to see the notes when CI fails
expect_equal(check_out[["notes"]], expected = "future file timestamps")
}
}
} else {
print(" ==== Interactive ====")
Expand Down Expand Up @@ -397,7 +402,8 @@ usethis::with_project(dummypackage, {
# Do not check inside check if on CRAN
skip_on_os(os = c("windows", "solaris"))

# If this check is run inside a not "--as-cran" check, then it wont work as expected
# If this check is run inside a not "--as-cran" check,
# then it wont work as expected
check_out <- rcmdcheck::rcmdcheck(dummypackage,
quiet = TRUE,
args = c("--no-manual"),
Expand All @@ -408,13 +414,22 @@ usethis::with_project(dummypackage, {
expect_true(length(check_out[["errors"]]) == 0)
expect_true(length(check_out[["warnings"]]) <= 1)
if (length(check_out[["warnings"]]) == 1) {
expect_true(grepl("there is no package called", check_out[["warnings"]]))
expect_true(grepl(
"there is no package called",
check_out[["warnings"]]
))
}
# ‘MASS’
# print(" -- warnings --")
# print(check_out[["warnings"]])

# Notes are different on CRAN
skip_on_cran()
expect_true(length(check_out[["notes"]]) == 0)

length_notes <- length(check_out[["notes"]])
expect_true(length_notes == 0)

if (length_notes != 0) {
# Keep here to see the notes when CI fails
expect_equal(check_out[["notes"]], expected = "zero notes")
}
} else {
expect_error(
suppressMessages(
Expand All @@ -429,7 +444,12 @@ usethis::with_project(dummypackage, {
)

# Should not be any errors with templates in interactive
check_lines <- readLines(file.path(checkdir, paste0(basename(dummypackage), ".Rcheck"), "00check.log"))
check_lines <- readLines(
file.path(
checkdir, paste0(basename(dummypackage), ".Rcheck"),
"00check.log"
)
)
expect_equal(check_lines[length(check_lines)], "Status: OK")
unlink(checkdir, recursive = TRUE)
}
Expand All @@ -443,7 +463,12 @@ dir.create(dummypackage)

# {fusen} steps
fill_description(pkg = dummypackage, fields = list(Title = "Dummy Package"))
dev_file <- suppressMessages(add_flat_template(pkg = dummypackage, overwrite = TRUE, open = FALSE))
dev_file <- suppressMessages(
add_flat_template(
pkg = dummypackage,
overwrite = TRUE, open = FALSE
)
)
flat_file <- dev_file[grepl("flat_", dev_file)]

usethis::with_project(dummypackage, {
Expand Down

0 comments on commit 7376f11

Please sign in to comment.