Make Ruby resolution work without manual mise activation#1529
Conversation
Scripts using `#!/usr/bin/env ruby` (like `bin/setup`) failed when the caller's shell didn't have mise's Ruby on PATH. Document the shims-in-zshenv install so contributors fix it once globally, and activate mise explicitly in `bin/conductor-setup` since /bin/sh does not source ~/.zshenv. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
External tooling (CI, deploys, IDEs) already reads .ruby-version by convention. Enable mise's idiomatic-version-file support at the project level so mise reads the same file, eliminating drift between two declarations of the same version. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@jmilljr24 will mise still work with your setup if we remove ruby declaration from mise.toml in favor of ruby-version ruby? |
This is from the mise docs. So it should be fine. Maybe needs a note in the contributing guide to enable the setting during initial setup. |
| - **Add mise shims to your PATH** so the project's Ruby is resolved in every shell — including non-interactive contexts like `bin/setup`, IDE task runners, and cron. Add this to `~/.zshenv` (or `~/.bashrc` for bash) and restart your shell: | ||
| ```bash | ||
| export PATH="$HOME/.local/share/mise/shims:$PATH" | ||
| ``` | ||
| Without this, scripts with `#!/usr/bin/env ruby` may pick up the wrong Ruby (or fail to find one). |
There was a problem hiding this comment.
Is this specific to your computer?
There was a problem hiding this comment.
to the user's computer, yes. (whether they use zsh or bashrc)
There was a problem hiding this comment.
I get that but my question is why is this new? Like is the issue specific to your computer? I don't need to add a mise shim and I don't recall that being an issue when most people were setting up at r4g last year.
It's my understand that the point of mise is to handle the versions for us. Running a script just need to be done from the path of the project.
|
@jmilljr24 good call — I ended up enabling that setting at the project level in |
Replies to PR feedback: distinguish ~/.zshenv (loaded by every shell, including non-interactive) from ~/.zshrc (interactive only), and call out the right bash equivalents (~/.bash_profile + ~/.bashrc), since those determine whether IDE runners and cron pick up the project's Ruby. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previous wording assumed zsh. Restructure CONTRIBUTING.md as a table covering zsh, bash, and fish so contributors find their own shell rather than translating the zsh example. Point CLAUDE.md at the CONTRIBUTING table instead of duplicating zsh-specific guidance. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Awesome on the toml setting! I don't think the comments in contributing setup instructions should be there if it's not a generic requirement. There is the potential to cause some system wide issues for a new contributor when it's not strictly required. It seems you needed to export the path due to how conductor is working on your system? If so, maybe a comment on the AI section |
What is the goal of this PR and why is this important?
#!/usr/bin/env ruby(notablybin/setup) silently picked up the wrong Ruby — or failed entirely — when the caller's shell hadn't activated mise.bin/conductor-setupruns under/bin/sh, which does not source~/.zshenv.mise.tomland.ruby-version) which can drift.How did you approach the change?
Make Ruby resolution work without manual mise activation:
CONTRIBUTING.md— added shims-in-zshenv as a required step under the "Install mise" section of the local setup path, with a brief explanation of why (covers non-interactive shells, IDE runners, cron,bin/setup).CLAUDE.md— replaced the stale "runeval mise activatebefore any Ruby command" guidance with the same shims setup, so agents working in the repo follow the current install pattern.bin/conductor-setup— activates mise explicitly near the top (with a/opt/homebrew/bin/misefallback for cases where Conductor's inherited PATH doesn't include it). This script runs under#!/bin/sh, so the~/.zshenvapproach doesn't apply here.bin/setupitself stays a plain Ruby script — no bash wrapper, no shebang tricks. Once shims are on PATH (orbin/conductor-setuphas activated mise),#!/usr/bin/env rubyjust works.Make
.ruby-versionthe single source of truth:mise.toml— added[settings] idiomatic_version_file_enable_tools = ["ruby"]and removed the duplicateruby = "4.0.1"from[tools]. External tooling (CI, deploys, IDEs) already reads.ruby-versionby convention; this makes mise read it too. Project-scoped so every contributor's mise picks it up regardless of their global config.Anything else to add?
setup-bash-wrapper) is a leftover from an earlier approach that I abandoned in favor of the shims path. Not renaming since the PR exists.