Repository navigation
Add rig add --no-default and --without-path - #490
Conversation
`rig add` makes the first R version it installs the default when none is set yet. In user mode that also creates the R and Rscript quick links and registers the version with RStudio and Positron: on macOS it installs a LaunchAgent that sets RSTUDIO_WHICH_R at login. A tool that runs rig to install R, like RStudio (rstudio/rstudio#19229), wants R installed and nothing else, so `--no-default` skips setting the default. On Linux the user-mode R/Rscript aliases are then only refreshed when a default exists.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #490 +/- ##
==========================================
+ Coverage 65.50% 65.52% +0.01%
==========================================
Files 91 91
Lines 47030 47075 +45
==========================================
+ Hits 30809 30844 +35
- Misses 16221 16231 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
In user mode rig puts its quick-link directory on the PATH when it is missing: a line in the shell startup files on macOS and Linux, and the directory prepended to the user PATH in the registry on Windows. That is not part of setting the default, so `--no-default` leaves it in place; `--without-path` skips it, for tools that install R through rig and do not want the user's environment changed.
rig add --no-defaultrig add --no-default and --without-path
Windows registry issueThere is a problem with this on Windows, where the registry management is quite messy. rig installs into a temporary dir first, and the registry will point there. Currently we create OTOH there are other issues with the registry, e.g. sub-keys are not updated correctly, and the uninstall entries should be removed, probably. So I'll leave all the windows registry stuff to another PR. Docs and code style changesWhich is the right thing to do, I think, because for Positron we don't set a default (we can't, anyway), only the list of available versions which probably should be updated. I'll update the NEWS because it says that we leave the IDE settings alone, which is not entirely true. I'll update some docs and code style and I can merge this, and then I'll have another PR to fix/improve the windows registry handling. |
Also discuss admin mode.
|
Thanks! |
|
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this pull request. |
rig addmakes the first R version it installs the default when no default is set yet (set_default_if_none). In user mode that does more than install R: it creates theR/Rscriptquick links, andrig defaultregisters the version with RStudio and Positron, which on macOS means installing and loading theio.r-lib.rig.rstudio-which-rLaunchAgent that runslaunchctl setenv RSTUDIO_WHICH_R ...at every login.RStudio now bundles rig and runs
rig add <version> --userwhen a project asks for an R version that is not installed (rstudio/rstudio#19229). From RStudio's side the LaunchAgent is a problem: it outlives RStudio, overrides RStudio's own R selection for every launch from the Dock, and clobbers a user's ownlaunchctl setenv RSTUDIO_WHICH_R. The quick links also shadow e.g. Homebrew's R in the user's shell. There is currently no way to ask rig to only install R.This PR adds
rig add --no-default, which skipsset_default_if_noneon all three platforms. On Linux the user-modeR/Rscriptaliases are then refreshed only when a default exists (otherwise they would be dangling links intocurrent/bin). On Windowsmaybe_update_registry_defaultalready runs only when theR.exeshim exists, so nothing else changes there.rig default <version>still works afterwards for users who do want the default.A second commit adds
rig add --without-path. In user mode rig also puts its quick-link directory on the PATH when it is missing: a line in the shell startup files on macOS and Linux (check_local_bin_path), and the directory prepended to the user PATH in the registry on Windows (add_user_bin_to_path, fromsc_system_make_links). That happens on everyrig add, not only when a default is set, so--no-defaultleaves it in place;--without-pathskips it. It is a process-wide switch set from the parsedaddarguments, since the PATH is edited from helpers that take no arguments.The help text (
src/help/add.md, regenerated withmake help) now says what setting the default and the PATH setup involve, and NEWS has an entry.Verified:
cargo build,cargo fmt --check,cargo test --bin rig(1116 passed, 11 ignored), including a parsing test for both flags. I have not run the bats integration tests.Once a release includes this, RStudio will pass
--no-default --without-path; until then it undoes the default-R setup after the install (rstudio/rstudio#19229).