Skip to content

Commit

Permalink
Merge pull request #64 from opensafely-core/Jongmassey/rstudio-autosave
Browse files Browse the repository at this point in the history
Turn on  RStudio autosave
  • Loading branch information
Jongmassey authored Jul 26, 2024
2 parents 6e82b58 + 9908eb2 commit 669a76d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ set_rstudio_pref() {
#set RStudio working directory
set_rstudio_pref "initial_working_directory" "\"$1\""
#turn on RStudio autosave
set_rstudio_pref "auto_save_on_blur" "true"
set_rstudio_pref "auto_save_on_idle" "\"commit\""
#download and extract latest ehrql source
wget https://github.com/opensafely-core/ehrql/archive/main.zip -P .devcontainer
unzip -o .devcontainer/main.zip -d .devcontainer/
Expand Down
5 changes: 4 additions & 1 deletion tests/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ opensafely --version
# check R working directory
[ "$(Rscript -e 'getwd()')" == '[1] "/tmp/testdir"' ]

# check Rstudio working directory
# check Rstudio preferences
[ "$(jq '.initial_working_directory' < ~/.config/rstudio/rstudio-prefs.json )" == '"/tmp/testdir"' ]
[ "$(jq '.auto_save_on_blur' < ~/.config/rstudio/rstudio-prefs.json )" == 'true' ]
[ "$(jq '.auto_save_on_idle' < ~/.config/rstudio/rstudio-prefs.json )" == '"commit"' ]


# check preexisting Rstudio preference
[ "$(jq '.posix_terminal_shell' < ~/.config/rstudio/rstudio-prefs.json )" == '"bash"' ]
Expand Down

0 comments on commit 669a76d

Please sign in to comment.