From f2f9467c77e9e4c5d7d90d57f71fd44be077e809 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Wed, 11 Sep 2024 22:28:47 +0900 Subject: [PATCH] feat(r-dependent-packages): new `skip` option to skip R package installation --- src/r-dependent-packages/devcontainer-feature.json | 7 ++++--- test/r-dependent-packages/r-ver-skip.sh | 12 ++++++++++++ test/r-dependent-packages/scenarios.json | 8 ++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 test/r-dependent-packages/r-ver-skip.sh diff --git a/src/r-dependent-packages/devcontainer-feature.json b/src/r-dependent-packages/devcontainer-feature.json index 9883f55..ec66e40 100644 --- a/src/r-dependent-packages/devcontainer-feature.json +++ b/src/r-dependent-packages/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "R packages from the DESCRIPTION file (via pak)", "id": "r-dependent-packages", - "version": "0.1.0", + "version": "0.2.0", "description": "This Feature sets scripts to install dependent R packages from the DESCRIPTION file in the repository.", "documentationURL": "https://github.com/rocker-org/devcontainer-features/tree/main/src/r-dependent-packages", "options": { @@ -11,9 +11,10 @@ "enum": [ "onCreate", "updateContent", - "postCreate" + "postCreate", + "skip" ], - "description": "When to install the dependent R packages? Each option corresponds to the lifecycle scripts." + "description": "When to install the dependent R packages? Each option corresponds to the lifecycle scripts. 'skip' means to skip the installation." }, "pakVersion": { "type": "string", diff --git a/test/r-dependent-packages/r-ver-skip.sh b/test/r-dependent-packages/r-ver-skip.sh new file mode 100755 index 0000000..c9ad6fa --- /dev/null +++ b/test/r-dependent-packages/r-ver-skip.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +# Optional: Import test library bundled with the devcontainer CLI +source dev-container-features-test-lib + +# Feature-specific tests +check "R pak package" bash -c "R -q -e 'names(installed.packages()[, 3])' | grep pak" + +# Report result +reportResults diff --git a/test/r-dependent-packages/scenarios.json b/test/r-dependent-packages/scenarios.json index 2ccca09..4405065 100644 --- a/test/r-dependent-packages/scenarios.json +++ b/test/r-dependent-packages/scenarios.json @@ -16,6 +16,14 @@ } } }, + "r-ver-skip": { + "image": "rocker/r-ver:4", + "features": { + "r-dependent-packages": { + "when": "skip" + } + } + }, "r-ver-updatecontent": { "image": "rocker/r-ver:4", "features": {