asdf-ruby
asdf-ruby copied to clipboard
Install fails if your asdf version is set to the version you're installing
When I get a new computer I have a script that copies my tool-version file from my dotfiles into .config/asdf
With other languages this doesn't cause an issue because the install script is written in a different language to the language being run to install it.
However with the asdf-ruby install it goes to use ruby during the install itself.
so if you run ASDF_RUBY_ VERSION='2.6.4' asdf install ruby 2.6.4 you'll generate
asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:
ruby 2.6.3
ruby 2.6.2
then if you correct this by running
ASDF_RUBY_ VERSION='2.6.3' asdf install ruby 2.6.4
it then complains because
fatal: destination path 'ruby-build-source' already exists and is not an empty directory.
(I believe because when the original install fails it doesn't clean up the ruby-build-source dir)
I suspect that this is caused by either rubygems-plugin
which is the only ruby file in the asdf-ruby project or there is some underlying ruby inside asdf itself.
I suspect a possible solution to the original error is to set asdf install ruby to auto use ASDF_RUBY_VERSION='system' and a possible solution to the 'ruby-build-source' already exists might be for the install script to rm -rf an existing ruby-build-source before attempting to download the latest version.
Happy to expand further if this doesn't make sense or you want extra details.
Can you update to the latest version of asdf and asdf-ruby and test this again? I've not encountered this issue myself, and I tested this very scenario yesterday evening on a hobby project.
Closing due to lack of a response.