Skip to content

feat(installer): add stable C:\Ruby4Lich5\current junction to versioned Ruby tree - #37

Open
mrhoribu wants to merge 1 commit into
mainfrom
feat/add-junction-ruby-path
Open

feat(installer): add stable C:\Ruby4Lich5\current junction to versioned Ruby tree#37
mrhoribu wants to merge 1 commit into
mainfrom
feat/add-junction-ruby-path

Conversation

@mrhoribu

Copy link
Copy Markdown

What

Creates a stable C:\Ruby4Lich5\current directory junction that points at the
versioned Ruby tree laid down this install (e.g. C:\Ruby4Lich5\4.0.5), so
front-ends can hardcode C:\Ruby4Lich5\current\bin instead of a path that moves
every 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 and
forces every affected front-end to reconfigure. A stable current\bin gives them
one path that survives version changes.

How

Three additive edits, all in [Code]:

  • CurStepChanged var line extended with LinkPath, RubyDir.
  • A new rubygem-gated block in CurStepChanged (runs alongside, not inside, the
    existing lich block so it also fires for a rubyonly install). It clears any
    prior current, then creates the junction.
  • A new CurUninstallStepChanged that removes current on uninstall so it can't
    dangle after the versioned tree is gone.

Junction, not symbolic link

Uses mklink /J (directory junction), not mklink /D (symlink), deliberately.
A /D symlink needs SeCreateSymbolicLinkPrivilege, which a standard user does
not have unless Developer Mode is on — and this installer is
PrivilegesRequired=lowest, so a symlink would silently fail for many users. A
junction needs no elevation and works for a local, same-volume, absolute-path
redirect, which is exactly this case (both ends under C:\Ruby4Lich5). Front-ends
see current\bin\ruby.exe transparently.

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 an
otherwise-good install. The pre-clear uses plain rmdir (no /s), which removes
only 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 at
current is a larger change with its own failure modes (e.g. uninstalling one
version 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 recently
    installed Ruby. If older versioned dirs linger, current still resolves to the
    newest. This matches the motivation but is the one real behavioral contract here.
  • Pre-existing real current dir. Handled fail-safe (no data loss, junction
    just skipped that run). Chose this over rmdir /s.

Testing

No automated harness exists for a .iss, so this was reviewed by reading against
jrsoftware/issrc step ordering. Suggested manual matrix on a Windows box:

  1. Fresh full install -> C:\Ruby4Lich5\current\bin\ruby.exe -v resolves.
  2. Re-install a bumped Ruby version -> current now points at the new tree, old
    junction gone.
  3. rubyonly install -> current is still created.
  4. lichonly install -> no junction created, no error.
  5. Uninstall -> current removed, no unrelated files touched.

Added logic to create a junction for the Ruby installation path and handle its removal on uninstall.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 177edb96-19b9-4b7f-af80-8b90b3ffe125

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-junction-ruby-path

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Proposed next installer version

R4L5-v040.002.004

Compared against the latest installer release (R4L5-v040.002.003):

  • CI 3 -> 4 (installer/workflow files changed since R4L5-v040.002.003)

Review and bump installer-version in a real dispatch of build-ruby4lich5-installer.yaml to 040.002.004 when this PR is ready to ship as a release. This is a proposal only -- nothing is assigned automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant