Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ASDF as a manager object #1845

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Conversation

vinistock
Copy link
Member

Motivation

Migrate ASDF to the manager object implementation. This is the last version manager to migrate.

The only parts left of the Ruby activation restructuring is handling no version manager, custom Ruby activation and allowing manual selection of the Ruby installation.

Implementation

ASDF activation is similar to Rbenv. The main difference is that the asdf.sh file is not an executable and can only be sourced to allow invoking asdf.

In addition to that, the asdf documentation lists a number of different installation alternatives, all of which end up with the asdf.sh script in a different file path. I listed all possible paths described in the docs and we search for the script in those paths.

Then we source the script and use asdf exec ruby to run the activation script in the context of the activated Ruby. Like Rbenv, ASDF doesn't set GEM_HOME or GEM_PATH so we need to do that ourselves.

I tested this manually on a Spin instance where I installed ASDF.

Automated Tests

Added a test.

Manual Tests

  1. Start the extension on this branch
  2. Open a project with a .tools-version file
  3. Verify the Ruby LSP boots properly using the specified Ruby version

@vinistock vinistock added enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes labels Mar 27, 2024
@vinistock vinistock self-assigned this Mar 27, 2024
@vinistock vinistock requested a review from a team as a code owner March 27, 2024 18:25
vscode/src/ruby/asdf.ts Outdated Show resolved Hide resolved
vscode/src/ruby/asdf.ts Outdated Show resolved Hide resolved
@andyw8
Copy link
Contributor

andyw8 commented Mar 27, 2024

ASDF also supports .ruby-version, will that work here?

@andyw8
Copy link
Contributor

andyw8 commented Mar 27, 2024

I use asdf on my personal machine so can try this later.

@vinistock
Copy link
Member Author

ASDF also supports .ruby-version, will that work here?

It should. We're invoking the asdf executable, so it should handle whatever ASDF handles in the terminal too.

I use asdf on my personal machine so can try this later.

Awesome! Please report back if everything is working.

@vinistock vinistock force-pushed the vs/migrate_asdf_to_manager_object branch 2 times, most recently from 0afe9f6 to ba2f65d Compare March 28, 2024 13:11
@vinistock vinistock force-pushed the vs/migrate_asdf_to_manager_object branch from ba2f65d to 0c56c7a Compare April 5, 2024 18:06
@vinistock vinistock force-pushed the vs/migrate_asdf_to_manager_object branch from 0c56c7a to b7d1673 Compare April 24, 2024 16:03
@vinistock vinistock requested a review from a team as a code owner April 24, 2024 16:03
@vinistock vinistock requested a review from andyw8 April 24, 2024 16:03
Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎩 successful on my personal machine with asdf.

@vinistock vinistock merged commit 30bc000 into main Apr 24, 2024
40 of 42 checks passed
@vinistock vinistock deleted the vs/migrate_asdf_to_manager_object branch April 24, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants