fix(gemset): add cwd to Gemset and set RBENV_DIR env var
#173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change adds a working dir field to the Gemset struct and passes this directory as the
RBENV_DIRenvironment variable when executing gem commands. This ensures thatrbenvuses the project's directory when resolving Ruby versions.Details
The Ruby extension uses
zed::Commandto invoke commands for managing its gems: updating, installing, and uninstalling. It seems thatzed::Commanddoes not set the working directory (cwd), which causes the invoked commands to run against the root directory. Below is the log of runningrbenvwith debug mode enabled via theRBENV_DEBUGenvironment variable:In the beginning, there is this line
+(/opt/homebrew/bin/rbenv:31): RBENV_DIR=/which indicates that the working directory is not set to the worktree andrbenvuses the root directory.The possible solutions are:
rbenvRBENV_DIRin the Ruby extension before invoking anygemcommand. It's a hack, but it works.zed::Commandimplementation to to see if the working directory can be changed to the worktree root.Closes #158
Closes #152