Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r-packages] allow whitespace in packages #207

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/r-packages/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "R packages (via pak)",
"id": "r-packages",
"version": "1.0.3",
"version": "1.1.3",
eitsupi marked this conversation as resolved.
Show resolved Hide resolved
"description": "Installs R packages via the pak R package's function. R must be already installed.",
"documentationURL": "https://github.com/rocker-org/devcontainer-features/tree/main/src/r-packages",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion src/r-packages/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ install_r_packages() {
fi
fi

su "${USERNAME}" -c "R -q -e \"pak::repo_add(${ADDITIONAL_REPOSITORIES}); pak::pak(unlist(strsplit('${packages}', ','))); pak::cache_clean()\""
su "${USERNAME}" -c "R -q -e \"pak::repo_add(${ADDITIONAL_REPOSITORIES}); pak::pak(trimws(unlist(strsplit('${packages}', ',')))); pak::cache_clean()\""

if [ "${is_apt}" = "true" ]; then
# Clean up
Expand Down
14 changes: 14 additions & 0 deletions test/apt-packages/install-curl-nano-wget-ws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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 "curl" curl --version
check "nano" nano --version
check "wget" wget --version

# Report result
reportResults
8 changes: 8 additions & 0 deletions test/apt-packages/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
}
}
},
"install-curl-nano-wget-ws": {
"image": "debian:stable-slim",
"features": {
"apt-packages": {
"packages": "curl, nano, wget"
}
}
},
"only-upgrade": {
"image": "debian:stable-slim",
"features": {
Expand Down
13 changes: 13 additions & 0 deletions test/r-packages/install-cli-rlang-ws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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 cli package" R -q -e 'names(installed.packages()[, 3])' | grep cli
check "R rlang package" R -q -e 'names(installed.packages()[, 3])' | grep rlang

# Report result
reportResults
8 changes: 8 additions & 0 deletions test/r-packages/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
}
}
},
"install-cli-rlang-ws": {
"image": "rocker/r-ver:4",
"features": {
"r-packages": {
"packages": "cli, rlang"
}
}
},
"install-from-github": {
"image": "rocker/r-ver:4",
"features": {
Expand Down