Skip to content

Commit

Permalink
Merge branch 'release/0.14.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamblake committed Oct 27, 2023
2 parents 3a8e5ca + c9449d9 commit 7a603b1
Show file tree
Hide file tree
Showing 23 changed files with 349 additions and 172 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
^codecov\.yml$
^data-raw$
^\.vscode$
^bin$
^.lintr$
^CHANGELOG\.md$
^NOTES\.md$
^cran-comments\.md$
^CRAN-SUBMISSION$
10 changes: 10 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
on:
push:
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
- "bin/**"
branches:
- main
- release/*
Expand All @@ -9,6 +14,11 @@ on:
- develop
- release/*
- hotfix/*
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
- "bin/**"
workflow_dispatch:

name: R-CMD-check
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
on:
push:
branches: [main]
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
- "bin/**"
pull_request:
branches: [main]
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
- "bin/**"

name: test-coverage

Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/test-non-interactive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
on:
push:
branches:
- main
- release/*
- hotfix/*
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
pull_request:
branches:
- develop
- release/*
- hotfix/*
paths-ignore:
- "*.md"
- "*.Rmd"
- ".vscode/**"
workflow_dispatch:

name: Test non-interactive

jobs:
test:
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: windows-latest, r: "3.6" } the cli::rule dashes get messed up
- { 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:
# https://github.com/actions/checkout
- uses: actions/checkout@v3

# https://github.com/r-lib/actions/tree/v2/setup-pandoc
- uses: r-lib/actions/setup-pandoc@v2

# https://github.com/r-lib/actions/tree/v2/setup-r
- 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

# https://github.com/r-lib/actions/tree/v2/setup-r-dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::devtools
needs: check

- name: Install the package
run: Rscript -e 'devtools::install()'

- name: Test loading in non-interactive mode (normal)
run: Rscript bin/load-non-interactive.r

- name: Test loading in non-interactive mode (quiet)
run: Rscript bin/load-non-interactive-quiet.r

- name: Test loading in non-interactive mode (quickstart)
run: Rscript bin/load-non-interactive-quickstart.r
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.Rhistory
.RData
.DS_Store
NOTES.md
README.html
CRAN-SUBMISSION
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: coursekata
Title: Packages and Functions for 'CourseKata' Courses
Version: 0.14.0
Date: 2023-10-11
Version: 0.14.1
Date: 2023-10-26
Authors@R: c(
person("Adam", "Blake", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0001-7881-8652")),
Expand Down Expand Up @@ -35,8 +35,7 @@ Imports:
rlang (>= 1.0.2),
supernova (>= 2.5.1),
vctrs (>= 0.4.1),
viridisLite,
yesno (>= 0.1.2)
viridisLite
Suggests:
fivethirtyeight (>= 0.6.2),
lubridate (>= 1.8.0),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# `coursekata` change log

## coursekata 0.14.1

- Reduce calls to `pak::pkg_status()` to improve startup time
- Address issue where `require(lib.loc = ...)` was sometimes being passed `NA`
- Appropriately skip actions that require the user when running in non-interactive mode (and add related tests)

## coursekata 0.14.0

- Remove deprecated `gf_model_old()` function
Expand Down
27 changes: 23 additions & 4 deletions R/coursekata_attach.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#' Attach the CourseKata course packages
#'
#' @param do_not_ask Prevent asking the user to install missing packages (they are skipped).
#' @param quietly Whether to suppress messages.
#'
#' @return A named logical vector indicating which packages were attached.
#'
#' @export
#' @examples
#' coursekata_attach()
coursekata_attach <- function(quietly = FALSE) {
to_attach <- coursekata_detached()
invisible(pkg_require(to_attach, quietly = quietly))
coursekata_attach <- function(do_not_ask = FALSE, quietly = FALSE) {
!do_not_ask && pkg_check_installed(coursekata_pkgs)
detached <- coursekata_detached()
installed <- coursekata_pkgs[pkg_is_installed(coursekata_pkgs)]
attached <- pkg_require(detached[detached %in% installed], quietly = quietly)

result <- rep_named(detached, FALSE)
result[names(attached)] <- TRUE
invisible(result)
}


Expand All @@ -23,7 +30,9 @@ coursekata_attach <- function(quietly = FALSE) {
#'
#' @noRd
coursekata_attach_message <- function(pkgs) {
if (length(pkgs) == 0) return(NULL)
if (length(pkgs) == 0) {
return(NULL)
}

info <- coursekata_packages()
version <- ifelse(is.na(info$version), "", info$version)
Expand All @@ -42,3 +51,13 @@ coursekata_attach_message <- function(pkgs) {
sep = "\n"
)
}


#' List all currently NOT attached CourseKata course packages
#'
#' @return A character vector of the course packages that are not attached.
#'
#' @noRd
coursekata_detached <- function() {
coursekata_pkgs[!pkg_is_attached(coursekata_pkgs)]
}
2 changes: 1 addition & 1 deletion R/coursekata_install.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ coursekata_install <- function(...) {
}

cli::cat_line()
pkg_install(behind$package, ...)
pak::pkg_install(pkg_fix_remote_names(behind$package), ...)
invisible(coursekata_packages(TRUE))
}

Expand Down
22 changes: 1 addition & 21 deletions R/coursekata_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ coursekata_packages <- function(check_remote_version = FALSE) {
statuses <- pak::pkg_status(pkgs)
info <- data.frame(
package = pkgs,
installed = pkg_is_installed(pkgs, statuses),
installed = pkg_is_installed(pkgs),
attached = pkg_is_attached(pkgs),
version = pkg_version(pkgs, statuses),
stringsAsFactors = FALSE
Expand All @@ -34,23 +34,3 @@ coursekata_packages <- function(check_remote_version = FALSE) {

info
}


#' List all currently attached CourseKata course packages
#'
#' @return A character vector of the course packages that have been attached.
#'
#' @noRd
coursekata_attached <- function() {
coursekata_pkgs[pkg_is_attached(coursekata_pkgs)]
}


#' List all currently NOT attached CourseKata course packages
#'
#' @return A character vector of the course packages that are not attached.
#'
#' @noRd
coursekata_detached <- function() {
coursekata_pkgs[!pkg_is_attached(coursekata_pkgs)]
}
Loading

0 comments on commit 7a603b1

Please sign in to comment.