Closed SenZmaKi closed 8 months ago
That's a Ruby error, not a YARD error. I don't have HOME
set.
Have you tried this in stand-alone Ruby?
ruby -e "puts File.join(ENV['HOME'], '.yard')"
-- or --
ruby -e "puts File.expand_path('~/.yard')"
Here are my outputs
ruby -e "puts File.expand_path('~/.yard')"
-e:1:in `expand_path': non-absolute home (ArgumentError)
puts File.expand_path('~/.yard')
^^^^^^^^^
from -e:1:in `<main>'
ruby -e "puts File.join(ENV['HOME'], '.yard')"
\Users\PC/.yard
Windows relies on USERPROFILE (or HOMEDRIVE / HOMEPATH) to derive your home directory from ~, not HOME. You should print your full ENV to see if those are missing. This definitely sounds like a general environment issue with your Ruby installation and not specific to yard
These are all the environment variables you mentioned
> echo %HOMEPATH%
\Users\PC
> echo %USERPROFILE%
C:\Users\PC
> echo %HOMEDRIVE%
C:
> echo %HOMEPATH%
\Users\PC
> echo %HOME%
\Users\PC
I'll leave it up to you to close it since you might wanna come back to it
@SenZmaKi
From the Ruby error, ENV['HOME']
needs to be an absolute path, so something like C:/Users/PC
.
I haven't looked thru the code, but I set something similar to the following for running tests on Windows BUNDLE_PATH: "/usr/vendor"
, which exists as C:/usr/vendor
, and it works. Not sure how Bundler resolves the path.
@MSP-Greg
When I set use File.join(ENV['HOME'], '.yard')
it works just fine the problem comes with File.expand_path('~/.yard')
This is definitely an issue with Ruby, not yard, and as such, is an upstream issue with Ruby and should be reported there. This works in our CI testing, on my Windows machine, etc. I remember seeing path expansion issues before, but only when Ruby was not configured correctly.
I've fixed it finally, the problem was with the HOME
environment variable. I had set it personally for convenience and its value was HOMEPATH
which is \Users\PC
, I assumed most tools on windows would use HOMEPATH
cause HOME
isn't typically available on windows, even then since it's value is still set to HOMEPATH
there'd be no issue.
Ruby for whatever reason still chose to check in HOME
and expanded it to \Users\PC
which then caused the non-absolute home error. When I deleted HOME
or set it to C:\Users\PC
yard worked. This probably means ruby isn't using HOMEPATH
when expanding home or maybe doing some extra work after expanding HOMEPATH
to make it absolute which wasn't the case with HOME
.
Thanks for the help and sorry for the inconvenience.
There's no mention anywhere that yard is Unix only, on Windows yard doesn't even start
I have the
HOME
environment variable set, maybe gettingHOME
directly fromENV
then joining to.yard
would fix it, something like