diff --git a/DESCRIPTION b/DESCRIPTION index 4f5e669..dd331e6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,7 +42,7 @@ Suggests: sf Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.1 Config/testthat/edition: 3 Config/testthat/parallel: true URL: https://docs.ropensci.org/unifir/, https://github.com/ropensci/unifir diff --git a/NAMESPACE b/NAMESPACE index 1011f7f..ba9680e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(print,unifir_script) export(action) export(add_default_player) export(add_default_tree) @@ -26,3 +27,4 @@ export(validate_path) export(validate_single_path) export(waiver) importFrom(R6,R6Class) +importFrom(utils,head) diff --git a/R/load_png.R b/R/load_png.R index a84a514..2cd6fb6 100644 --- a/R/load_png.R +++ b/R/load_png.R @@ -35,7 +35,7 @@ load_png <- function(script, readChar(prop$prop_file, file.info(prop$prop_file)$size), .open = "%", .close = "%", - method_name = prop$method_name, + method_name = prop$method_name ) }, using = c("System", "System.IO", "UnityEngine") diff --git a/R/make_script.R b/R/make_script.R index 114da25..8ec938e 100644 --- a/R/make_script.R +++ b/R/make_script.R @@ -46,8 +46,6 @@ make_script <- function(project, ), using = character(0) ) - - class(script) <- "unifir_script" script } diff --git a/R/read_raw.R b/R/read_raw.R index 1340f0a..561fefd 100644 --- a/R/read_raw.R +++ b/R/read_raw.R @@ -35,7 +35,7 @@ read_raw <- function(script, readChar(prop$prop_file, file.info(prop$prop_file)$size), .open = "%", .close = "%", - method_name = prop$method_name, + method_name = prop$method_name ) }, using = c("System", "System.IO") diff --git a/R/unifir-package.R b/R/unifir-package.R index 56a717e..493e229 100644 --- a/R/unifir-package.R +++ b/R/unifir-package.R @@ -5,5 +5,6 @@ #' @importFrom R6 R6Class ## usethis namespace: start +#' @importFrom utils head ## usethis namespace: end NULL diff --git a/R/utils.R b/R/utils.R index 20ae0d0..34c00b9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -35,3 +35,12 @@ unity_version <- function(unity = NULL) { #' #' @export waiver <- function() structure(list(), class = "waiver") + +#' @export +print.unifir_script <- function(x, ..., n = 6) { + cat(paste("A `unifir_script` object with", nrow(x$beats), "props\n\n")) + display <- head(x$beats[c("name", "type")], n) + rownames(display) <- NULL + print(display, ..., n) + invisible(x) +} diff --git a/revdep/README.md b/revdep/README.md index 34db080..885c39b 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,27 +1,25 @@ # Platform -|field |value | -|:--------|:-------------------------------------------------------------| -|version |R version 4.2.1 (2022-06-23) | -|os |Ubuntu 20.04.4 LTS | -|system |x86_64, linux-gnu | -|ui |RStudio | -|language |(EN) | -|collate |en_US.UTF-8 | -|ctype |en_US.UTF-8 | -|tz |America/New_York | -|date |2022-08-11 | -|rstudio |2022.07.1+554 Spotted Wakerobin (desktop) | -|pandoc |2.18 @ /usr/lib/rstudio/bin/quarto/bin/tools/ (via rmarkdown) | +|field |value | +|:--------|:---------------------------------------------------------------| +|version |R version 4.2.2 Patched (2022-11-10 r83330) | +|os |Ubuntu 22.04.1 LTS | +|system |x86_64, linux-gnu | +|ui |RStudio | +|language |(EN) | +|collate |en_US.UTF-8 | +|ctype |en_US.UTF-8 | +|tz |America/New_York | +|date |2022-12-02 | +|rstudio |2022.07.2+576 Spotted Wakerobin (desktop) | +|pandoc |2.19.2 @ /usr/lib/rstudio/bin/quarto/bin/tools/ (via rmarkdown) | # Dependencies -|package |old |new |Δ | -|:---------------|:-----|:----------|:--| -|unifir |0.2.1 |0.2.1.9000 |* | -|glue |1.6.2 |1.6.2 | | -|proceduralnames |0.2.1 |0.2.1 | | -|R6 |2.5.1 |2.5.1 | | +|package |old |new |Δ | +|:---------------|:-----|:-----|:--| +|unifir |0.2.2 |0.2.2 |NA | +|proceduralnames |0.2.2 |0.2.2 |NA | # Revdeps diff --git a/tests/testthat/test-associate_coordinates.R b/tests/testthat/test-associate_coordinates.R index 3bb23e6..1a40c79 100644 --- a/tests/testthat/test-associate_coordinates.R +++ b/tests/testthat/test-associate_coordinates.R @@ -3,6 +3,8 @@ test_that("associate_coordinates is stable", { # Being not in the possession of M1 macs nor the ability to fix terra, # I am temporarily skipping this test until one of those things changes skip_on_os(os = "mac", arch = "aarch64") + skip_if_not_installed("sf") + skip_if_not_installed("terra") out <- associate_coordinates( sf::st_as_sf(data.frame(x = 5, y = 5), coords = c("x", "y"), crs = "EPSG:5071"), terra::rast(matrix(data = rep(1, 100), nrow = 10), crs = "EPSG:5071") diff --git a/tests/testthat/test-make_script.R b/tests/testthat/test-make_script.R index 16f3d90..5237678 100644 --- a/tests/testthat/test-make_script.R +++ b/tests/testthat/test-make_script.R @@ -7,8 +7,8 @@ test_that("make_script always produces the same script", { initialize_project = NULL ) - expect_match( - class(example_script), + expect_s3_class( + example_script, "unifir_script" )