feat(installer): add stable C:\Ruby4Lich5\current junction to versioned Ruby tree - #37
feat(installer): add stable C:\Ruby4Lich5\current junction to versioned Ruby tree#37mrhoribu wants to merge 1 commit into
Conversation
Added logic to create a junction for the Ruby installation path and handle its removal on uninstall.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Proposed next installer version
Compared against the latest installer release (R4L5-v040.002.003):
Review and bump |
What
Creates a stable
C:\Ruby4Lich5\currentdirectory junction that points at theversioned Ruby tree laid down this install (e.g.
C:\Ruby4Lich5\4.0.5), sofront-ends can hardcode
C:\Ruby4Lich5\current\bininstead of a path that movesevery time the baked Ruby version changes.
Why
Some front-end clients have to hardcode the Ruby bin location in their prefs.
Today that's
C:\Ruby4Lich5\<rubyver>\bin, which changes on every Ruby bump andforces every affected front-end to reconfigure. A stable
current\bingives themone path that survives version changes.
How
Three additive edits, all in
[Code]:CurStepChangedvar line extended withLinkPath, RubyDir.rubygem-gated block inCurStepChanged(runs alongside, not inside, theexisting
lichblock so it also fires for arubyonlyinstall). It clears anyprior
current, then creates the junction.CurUninstallStepChangedthat removescurrenton uninstall so it can'tdangle after the versioned tree is gone.
Junction, not symbolic link
Uses
mklink /J(directory junction), notmklink /D(symlink), deliberately.A
/Dsymlink needsSeCreateSymbolicLinkPrivilege, which a standard user doesnot have unless Developer Mode is on — and this installer is
PrivilegesRequired=lowest, so a symlink would silently fail for many users. Ajunction needs no elevation and works for a local, same-volume, absolute-path
redirect, which is exactly this case (both ends under
C:\Ruby4Lich5). Front-endssee
current\bin\ruby.exetransparently.Non-fatal by design
Ruby is already fully installed and usable at the versioned path before the
junction is attempted. A junction hiccup (AV interference, a pre-existing
non-empty
current) logs a warning and continues rather than aborting anotherwise-good install. The pre-clear uses plain
rmdir(no/s), which removesonly a junction's reparse point — never the target's files — and fails safe on a
real non-empty directory instead of deleting it.
Scope / non-goals
PATH, file associations, and the registry entries are intentionally left pointed
at the versioned path (
{app}\{#RubyVersion}\bin\...). Repointing those atcurrentis a larger change with its own failure modes (e.g. uninstalling oneversion breaking PATH) and would be a separate discussion. This PR only adds the
convenience path the front-ends asked for.
Behavioral decisions worth a look
current= last installed. The junction always follows the most recentlyinstalled Ruby. If older versioned dirs linger,
currentstill resolves to thenewest. This matches the motivation but is the one real behavioral contract here.
currentdir. Handled fail-safe (no data loss, junctionjust skipped that run). Chose this over
rmdir /s.Testing
No automated harness exists for a
.iss, so this was reviewed by reading againstjrsoftware/issrcstep ordering. Suggested manual matrix on a Windows box:fullinstall ->C:\Ruby4Lich5\current\bin\ruby.exe -vresolves.currentnow points at the new tree, oldjunction gone.
rubyonlyinstall ->currentis still created.lichonlyinstall -> no junction created, no error.currentremoved, no unrelated files touched.