Skip to content

Complete XDG-aware RubyGems lookup and executable PATH setup across shells - #30

Merged
szmyty merged 16 commits into
mainfrom
copilot/feat-complete-xdg-aware-ruby-gem-config
Sep 12, 2026
Merged

szmyty merged 16 commits into
mainfrom
copilot/feat-complete-xdg-aware-ruby-gem-config

Conversation

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Mantle already set XDG-oriented RubyGems storage, but not the corresponding lookup and executable discovery contract. This change makes Ruby gem installs predictable across shell initialization by aligning GEM_HOME, GEM_PATH, GEM_SPEC_CACHE, and ${GEM_HOME}/bin behavior in Bash/Zsh/Fish without clobbering explicit user overrides.

  • RubyGems environment contract

    • Default GEM_HOME to "$XDG_DATA_HOME/gem" when unset.
    • Keep GEM_SPEC_CACHE under "$XDG_CACHE_HOME/gem/specs".
    • Derive GEM_PATH from the active gem env path rather than forcing GEM_PATH="$GEM_HOME", so system/default gem paths remain visible.
    • Use Ruby’s platform path separator when parsing and exporting GEM_PATH.
  • Executable discovery

    • Project ${GEM_HOME}/bin into Mantle’s deterministic PATH construction for Bash/Zsh and Fish.
    • Add the gem bin path even before the directory exists so executables installed later in the same shell become immediately discoverable.
    • Normalize trailing slashes and avoid duplicate logical PATH entries across repeated initialization.
  • Override and safety behavior

    • Preserve explicit GEM_HOME, GEM_PATH, and GEM_SPEC_CACHE.
    • Warn instead of guessing when GEM_HOME is relative; in that case Mantle does not derive GEM_PATH or project a gem bin path.
    • Surface ambiguous Ruby-manager situations by warning when Mantle cannot safely determine a RubyGems lookup path.
  • Cross-shell alignment

    • Apply the same RubyGems policy to the POSIX/Bash/Zsh runtime path and the native Fish environment path.
    • Keep shell-specific implementation details consistent around normalization and deduplication.
  • Documentation and hermetic coverage

    • Document the RubyGems/XDG contract, including interaction with system Ruby, Homebrew Ruby, asdf, rbenv, mise, and Bundler.
    • Add isolated integration coverage for default behavior, user overrides, re-sourcing, same-shell executable resolution, relative GEM_HOME, and live RubyGems path derivation when a real runtime is present.
export GEM_HOME="${XDG_DATA_HOME}/gem"
export GEM_SPEC_CACHE="${XDG_CACHE_HOME}/gem/specs"
export GEM_PATH="$(gem env path)"
export PATH="${GEM_HOME}/bin:${PATH}"

Copilot AI and others added 15 commits September 12, 2026 10:21
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Copilot AI changed the title [WIP] Complete XDG-aware Ruby gem configuration and executable PATH support Complete XDG-aware RubyGems lookup and executable PATH setup across shells Sep 12, 2026
Copilot AI requested a review from szmyty September 12, 2026 10:32
@szmyty
szmyty marked this pull request as ready for review September 12, 2026 10:33
@szmyty
szmyty merged commit 44a2c3d into main Sep 12, 2026
@szmyty
szmyty deleted the copilot/feat-complete-xdg-aware-ruby-gem-config branch September 12, 2026 10:33
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.

feat(environment): complete XDG-aware Ruby gem configuration and executable PATH support

2 participants