Skip to content

Commit

Permalink
Propagate renv.lock from pharmaverse/admiralci (#2119)
Browse files Browse the repository at this point in the history
renv / codespaces update from pharmaverse/admiralci

Co-authored-by: galachad <[email protected]>
Co-authored-by: Ben Straub <[email protected]>
  • Loading branch information
3 people authored Oct 8, 2023
1 parent ef44637 commit b575055
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Set renv profile base on R version.
.get_dependencies <- function(project_dir) {

admdev_loc <- find.package("admiraldev", lib.loc = .libPaths(), quiet = TRUE)
adm_dev_suggests <- if(length(admdev_loc) != 0) {
adm_dev_suggests <- if (length(admdev_loc) != 0) {
renv:::renv_dependencies_discover_description(admdev_loc, fields = c("Depends", "Imports", "LinkingTo", "Suggests"))
} else {
data.frame(Packages = character(0))
Expand All @@ -19,7 +18,7 @@
))
)
)
packages[!(packages %in% c("admiral", "admiraldev", "admiralci", "admiral.test", "pharmaversesdtm", getwd()))]
packages[!(packages %in% c("admiral", "admiraldev", "admiralci", "pharmaversesdtm", getwd()))]
}

options(renv.snapshot.filter = .get_dependencies)
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/4.1/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/4.2/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
6 changes: 6 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# move script rstudio into /usr/bin
sudo cp "$(pwd)/.devcontainer/rstudio.sh" /usr/bin/rstudio
sudo chmod +x /usr/bin/rstudio

# Restore renv and install staged dependencies
R -q -e 'renv::restore(lockfile = file.path("renv", "profiles", paste(R.version$major, substr(R.version$minor, 1, 1), sep = "."), "renv.lock")); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = ".", verbose = 1), verbose = 1);'

# Define rstudio default working directory
jq --arg folder "$(pwd)/" '. + { "initial_working_directory": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json
5 changes: 5 additions & 0 deletions .devcontainer/rstudio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

$BROWSER "https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"

exit 1
1 change: 0 additions & 1 deletion renv/profiles/4.1/renv/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"ignored.packages": [
"admiral",
"admiraldev",
"admiral.test",
"admiralci",
"pharmaversesdtm"
],
Expand Down
1 change: 0 additions & 1 deletion renv/profiles/4.2/renv/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"ignored.packages": [
"admiral",
"admiraldev",
"admiral.test",
"admiralci",
"pharmaversesdtm"
],
Expand Down
1 change: 0 additions & 1 deletion renv/profiles/4.3/renv/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"ignored.packages": [
"admiral",
"admiraldev",
"admiral.test",
"admiralci",
"pharmaversesdtm"
],
Expand Down
4 changes: 2 additions & 2 deletions renv/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"ignored.packages": [
"admiral",
"admiraldev",
"admiral.test",
"admiralci"
"admiralci",
"pharmaversesdtm"
],
"package.dependency.fields": [
"Imports",
Expand Down

0 comments on commit b575055

Please sign in to comment.