From 42b0394e804583c50024dadca9c2610a0b2e2fa8 Mon Sep 17 00:00:00 2001 From: Eric Scott Date: Thu, 7 Mar 2024 17:32:41 -0700 Subject: [PATCH 1/3] add repostatus badge --- README.Rmd | 1 + README.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.Rmd b/README.Rmd index f051a1d..63fcfb4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -16,6 +16,7 @@ knitr::opts_chunk$set( # geotargets +[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![R Targetopia](https://img.shields.io/badge/R_Targetopia-member-blue?style=flat&labelColor=gray)](https://wlandau.github.io/targetopia/) [![R-CMD-check](https://github.com/njtierney/geotargets/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/njtierney/geotargets/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/njtierney/geotargets/branch/master/graph/badge.svg)](https://app.codecov.io/gh/njtierney/geotargets?branch=master) diff --git a/README.md b/README.md index 46a8fd2..0946805 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ +[![Project Status: WIP – Initial development is in progress, but there +has not yet been a stable, usable release suitable for the +public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![R Targetopia](https://img.shields.io/badge/R_Targetopia-member-blue?style=flat&labelColor=gray)](https://wlandau.github.io/targetopia/) [![R-CMD-check](https://github.com/njtierney/geotargets/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/njtierney/geotargets/actions/workflows/R-CMD-check.yaml) From 7d137319c3ff547893f998a3856831795bb7c9ae Mon Sep 17 00:00:00 2001 From: Eric Scott Date: Thu, 7 Mar 2024 17:33:13 -0700 Subject: [PATCH 2/3] replace R-CMD-check action --- .github/workflows/R-CMD-check.yaml | 50 +++++++++++++++++++++ .github/workflows/action.yaml | 72 ------------------------------ 2 files changed, 50 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .github/workflows/action.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..14159b7 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml deleted file mode 100644 index 25660c0..0000000 --- a/.github/workflows/action.yaml +++ /dev/null @@ -1,72 +0,0 @@ -name: 'check-r-package' -description: 'Action to check R package with rcmdcheck. Assumes that rcmdcheck has already been installed.' -author: 'Jim Hester' -inputs: - args: - description: 'Arguments to pass to the `args` parameter of rcmdcheck. Must be an R expression. Note that it often needs to be quoted in YAML, see the README for details.' - default: 'c("--no-manual", "--as-cran")' - build_args: - description: 'Arguments to pass to the `build_args` parameter of rcmdcheck. Note that it often needs to be quoted in YAML, see the README for details.' - default: '"--no-manual"' - error-on: - description: 'What type of result should cause a build error? Note that it often needs to be quoted in YAML, see the README for details.' - default: '"warning"' - check-dir: - description: 'Where should the check output go? Note that it often needs to be quoted in YAML, see the README for details.' - default: '"check"' - working-directory: - description: 'Using the working-directory keyword, you can specify the working directory of where "rcmdcheck::rcmdcheck" is run.' - default: '.' - upload-snapshots: - description: 'Whether to upload all testthat snapshots as an artifact.' - default: false - upload-results: - description: 'Whether to upload check results for successful runs too.' - default: false - artifact-name: - description: | - Use this to override the default artifact name for the check results. - snapshot-artifact-name: - description: | - Use this to override the default artifact name for testthat snapshots. - -runs: - using: "composite" - steps: - - name: Check - id: rcmdcheck - run: | - ## -------------------------------------------------------------------- - options(crayon.enabled = TRUE) - cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE) - if (Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "") == "") Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false") - if (Sys.getenv("_R_CHECK_CRAN_INCOMING_", "") == "") Sys.setenv("_R_CHECK_CRAN_INCOMING_" = "false") - cat("check-dir-path=", file.path(getwd(), (${{ inputs.check-dir }})), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) - check_results <- rcmdcheck::rcmdcheck(args = (${{ inputs.args }}), build_args = (${{ inputs.build_args }}), error_on = (${{ inputs.error-on }}), check_dir = (${{ inputs.check-dir }})) - shell: Rscript {0} - working-directory: ${{ inputs.working-directory }} - - - name: Show testthat output - if: always() - run: | - ## -------------------------------------------------------------------- - echo ::group::Show testthat output - find check -name 'testthat.Rout*' -exec cat '{}' \; || true - echo ::endgroup:: - shell: bash - working-directory: ${{ inputs.working-directory }} - - - name: Upload check results - if: failure() || inputs.upload-results != 'false' - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.artifact-name || format('{0}-{1}-r{2}-{3}-results', runner.os, runner.arch, matrix.config.r, matrix.config.id || strategy.job-index ) }} - path: ${{ steps.rcmdcheck.outputs.check-dir-path }} - - - name: Upload snapshots - if: inputs.upload-snapshots != 'false' - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.snapshot-artifact-name || format('{0}-{1}-r{2}-{3}-testthat-snapshots', runner.os, runner.arch, matrix.config.r, matrix.config.id || strategy.job-index ) }} - path: ${{ steps.rcmdcheck.outputs.check-dir-path }}/**/tests*/testthat/_snaps - if-no-files-found: ignore From 55cd5a689b16ae62c10adbf7167c996c06ccc4df Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 11 Mar 2024 11:49:40 +1100 Subject: [PATCH 3/3] Implement various fixes to pass R CMD Check * Update LICENSE using use_mit_licens() * Fix malformed DESCRIPTION - using changes from https://github.com/njtierney/geotargets/pull/7/files * add "packages" to utils::globalVariables to avoid CRAN NOTE * remove importing rlang, glue, and lifecycle - not needed currently (but will doon) * use `targets::tar_option_get` not `tar_option` * provide targetsnamespace a missing `tar_option_get` --> `targets::tar_option_get` * remove `utils` from Imports in DESCRIPTION, even though we import it, R CMD Check complained about this. Strange! --- .Rbuildignore | 1 + DESCRIPTION | 20 +++++++++----------- LICENSE | 2 ++ LICENSE.md | 21 +++++++++++++++++++++ NAMESPACE | 1 + R/geotargets-package.R | 11 ++++++++--- R/tar-geotiff.R | 4 ++-- R/tar-shapefile.R | 4 ++-- man/geotargets-package.Rd | 28 ++++++++++++++++++++++++++++ 9 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 LICENSE create mode 100644 LICENSE.md create mode 100644 man/geotargets-package.Rd diff --git a/.Rbuildignore b/.Rbuildignore index d0adfca..a7db44d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^README\.Rmd$ ^\.github$ ^codecov\.yml$ +^LICENSE\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 98c4486..1eb5ef7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,26 +1,25 @@ Package: geotargets -Title: Targets extensions for geospatial +Title: Targets extensions for geospatial formats Version: 0.0.0.9000 Authors@R: c( person( given = "Nicholas", - last = "Tierney", + family = "Tierney", email = "nicholas.tierney@gmail.com", role = c("aut", "cre"), - comment = c(ORCID = "https://orcid.org/0000-0003-1460-8722") + comment = c(ORCID = "0000-0003-1460-8722") ), person( - given = "", - last = "", - email = "", + given = "Eric", + family = "Scott", role = c("aut"), - comment = c(ORCID = "https://orcid.org/XXXX") + comment = c(ORCID = "0000-0002-7430-7879") ) ) Description: Provides extensions for various geospatial file formats, - including shapefiles, rasters, and more. See the vignettes for worked + such as shapefiles and rasters. See the vignettes for worked examples and demonstrations and explanations of how to use the various - package extensions + package extensions. License: MIT + file LICENSE Encoding: UTF-8 Language: en-GB @@ -28,8 +27,7 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 Imports: targets, - terra, - utils + terra Suggests: testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f791d4b --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2024 +COPYRIGHT HOLDER: geotargets authors diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..ec60a1b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2024 geotargets authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NAMESPACE b/NAMESPACE index 6ae9268..17876de 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,3 @@ # Generated by roxygen2: do not edit by hand +importFrom(utils,globalVariables) diff --git a/R/geotargets-package.R b/R/geotargets-package.R index 97c07e1..b20dd73 100644 --- a/R/geotargets-package.R +++ b/R/geotargets-package.R @@ -2,8 +2,13 @@ "_PACKAGE" ## usethis namespace: start -#' @import rlang -#' @importFrom glue glue -#' @importFrom lifecycle deprecated ## usethis namespace: end NULL + +# clear CRAN checks spotting floating global variables +#' @importFrom utils globalVariables +utils::globalVariables( + c( + "packages" + ) +) diff --git a/R/tar-geotiff.R b/R/tar-geotiff.R index e425551..3afdb7a 100644 --- a/R/tar-geotiff.R +++ b/R/tar-geotiff.R @@ -1,7 +1,7 @@ tar_geotiff <- function(name, command, pattern = NULL, - tidy_eval = targets::tar_option("tidy_eval"), + tidy_eval = targets::tar_option_get("tidy_eval"), library = targets::tar_option_get("library"), repository = targets::tar_option_get("repository"), iteration = targets::tar_option_get("iteration"), @@ -16,7 +16,7 @@ tar_geotiff <- function(name, cue = targets::tar_option_get("cue")) { name <- targets::tar_deparse_language(substitute(name)) - envir <- tar_option_get("envir") + envir <- targets::tar_option_get("envir") command <- targets::tar_tidy_eval( expr = as.expression(substitute(command)), diff --git a/R/tar-shapefile.R b/R/tar-shapefile.R index 541d83a..fdb8bba 100644 --- a/R/tar-shapefile.R +++ b/R/tar-shapefile.R @@ -36,7 +36,7 @@ format_shapefile <- targets::tar_format( tar_shapefile <- function(name, command, pattern = NULL, - tidy_eval = targets::tar_option("tidy_eval"), + tidy_eval = targets::tar_option_get("tidy_eval"), library = targets::tar_option_get("library"), repository = targets::tar_option_get("repository"), iteration = targets::tar_option_get("iteration"), @@ -51,7 +51,7 @@ tar_shapefile <- function(name, cue = targets::tar_option_get("cue")) { name <- targets::tar_deparse_language(substitute(name)) - envir <- tar_option_get("envir") + envir <- targets::tar_option_get("envir") command <- targets::tar_tidy_eval( expr = as.expression(substitute(command)), diff --git a/man/geotargets-package.Rd b/man/geotargets-package.Rd new file mode 100644 index 0000000..8838438 --- /dev/null +++ b/man/geotargets-package.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geotargets-package.R +\docType{package} +\name{geotargets-package} +\alias{geotargets} +\alias{geotargets-package} +\title{geotargets: Targets extensions for geospatial formats} +\description{ +Provides extensions for various geospatial file formats, such as shapefiles and rasters. See the vignettes for worked examples and demonstrations and explanations of how to use the various package extensions. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/njtierney/geotargets} + \item Report bugs at \url{https://github.com/njtierney/geotargets/issues} +} + +} +\author{ +\strong{Maintainer}: Nicholas Tierney \email{nicholas.tierney@gmail.com} (\href{https://orcid.org/0000-0003-1460-8722}{ORCID}) + +Authors: +\itemize{ + \item Eric Scott (\href{https://orcid.org/0000-0002-7430-7879}{ORCID}) +} + +} +\keyword{internal}