asdf-ruby
asdf-ruby copied to clipboard
shims are breaking `pwd` for ruby and bundler
Background Info
Forgive me as I've never submitted an issue report before.
The concept of "working directory" is breaking for binaries executed via asdf shims.
I am not sure if this is an asdf issue, or asdf-ruby/asdf-bundler issue.
asdf info:
> asdf info
OS:
Darwin Jades-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)
ASDF VERSION:
v0.8.1-a1ef92a
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/Users/jade.toyota/.asdf
ASDF INSTALLED PLUGINS:
bundler https://github.com/jonathanmorley/asdf-bundler.git
ruby https://github.com/asdf-vm/asdf-ruby.git
Actual Issues
If I run bundle init from my ~/proj/refresher.rb directory. this is the output I get:
~/proj/refresher.rb master*
> bundle init
Writing new Gemfile to /Users/jade.toyota/.asdf/bin/Gemfile
It should not write to ~/.asdf/bin/Gemfile, instead it should write to ~/proj/refresher.rb/Gemfile.
This doesn't only affect the bundler shim, it also affects the ruby shim. If I run:
ruby test.rb
I get an error because it can't find test.rb. so I have to do painful things like use absolute paths, for pwd:
~/proj/refresher.rb master* 33s
> ruby test.rb
/Users/jade.toyota/.asdf/installs/ruby/3.0.2/bin/ruby: No such file or directory -- test.rb (LoadError)
~/proj/refresher.rb master*
> ruby ./test.rb
/Users/jade.toyota/.asdf/installs/ruby/3.0.2/bin/ruby: No such file or directory -- ./test.rb (LoadError)
~/proj/refresher.rb master*
> ruby $(pwd)/test.rb
Run options: --seed 55101
# Running:
... expected output ...
I forgot to mention, if i use the system versions that were not installed via asdf, then it works, but that's using the super-old version that comes preinstalled with OSX, not the up-to-date version I installed using asdf.
i can't even asdf local ruby system or asdf local bundler system because those are still going thru shims. but if i bypass the shim and use the absolute path to access the pre-installed system versions, it works.
HI @unixsuperhero, thanks for the detailed issue. It doesn't appear that asdf is working for you. It's not clear to me exactly what is wrong on your machine, but I can confirm things are working for me:
$ mkdir asdf-ruby-test
$ cd asdf-ruby-test
$ bundler init
Writing new Gemfile to /Users/~/asdf-ruby-test/Gemfile
Does asdf reshim help anything? What does type -a bundler output for you?
Closing due to lack of a response. @unixsuperhero if you are still having this issue please reply with the output of asdf info and answer my question above.