asdf-ruby icon indicating copy to clipboard operation
asdf-ruby copied to clipboard

Install fails if your asdf version is set to the version you're installing

Open quintrino opened this issue 4 years ago • 1 comments

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.

quintrino avatar Sep 05 '19 04:09 quintrino

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.

Stratus3D avatar Oct 05 '22 13:10 Stratus3D

Closing due to lack of a response.

Stratus3D avatar Mar 20 '24 18:03 Stratus3D