Open taboularasa opened 10 years ago
(Related issue at https://github.com/sourcegraph/srclib/issues/28.)
Making srclib-ruby agnostic to the Ruby version manager you're using is definitely doable and desirable. I don't think it makes a ton of assumptions about rvm; it mainly uses it as a way to fetch and find the Ruby source code. The actual usage of rvm in the Ruby code is pretty minimal; most of it is in the Makefile. And it doesn't use it for any complex logic. So, it shouldn't be too hard to make it agnostic to whatever Ruby manager you use.
I am happy to give pointers on how to start if you're interested in taking this on.
@sqs Thanks for getting back to me. I'll look into changing the Makefile. At this point I would like to try just cloning the ruby source to generate the yardoc database and then put it somewhere. Have any ideas of where to put the generated .yard directory if it's not going to be dependent on a particular ruby version manager?
I suppose we could clone the Ruby source and the generated .yard
dir in the Ruby toolchain dir itself (~/.srclib/sourcegraph.com/sourcegraph/srclib-ruby/whatever
). That's kind of creating our own rvm/eb-env/etc.
Is it possible to determine the file that the statement require 'uri'
(or some other Ruby core library) loads? Then you could find the location of the Ruby core lib. Although that wouldn't necessarily contain the .c/.h files.
Or there could be a few modes, 1 for each Ruby version manager and 1 for just running plain ruby. Each mode would know how to determine the Ruby source dir for that particular environment.
I wouldn't be surprised if many people installing didn't have a copy of ruby source on hand. Once yard doc is done with it srclib-ruby
doesn't need the ruby source around either, am I right? I think it makes sense that the installation looks for an existing source directory for the currently available ruby version whatever that might be. If it can't find the source it will clone it from the git tag matching the ruby version to generate the docs. In either case there should be a standard location inside scrlib-ruby
to keep a copy of yard's output. That way the tool is not required to have conditional logic for every ruby version manager that comes along and would be resilient in the case that the user decided to switch version managers after installing srclib-ruby
Yep, that's right. The PR over at https://github.com/sourcegraph/srclib-ruby/pull/2 implements it this way. The only difference is that it doesn't try to match the git tag from the currently running Ruby version; it just uses $RUBY_VERSION
. Probably good enough for now; it's definitely an improvement.
@sqs I see the fix has been merged into master but running src toolchain install-std
gives me:
failed to install/upgrade Ruby (sourcegraph.com/sourcegraph/srclib-ruby) toolchain: no `rvm` in PATH; Ruby toolchain requires rvm (https://rvm.io)
do I need to specify the source somehow?
I need to update the srclib repository to not make that check anymore. I'll post when that update is done. (I am on airplane satellite wifi, so it might be a while.)
OK, I removed the rvm check in https://github.com/sourcegraph/srclib/commit/3669ee0fb49a8fa8f8a00fbd7d7a0908813243d9. I am having trouble installing the Ruby toolchain with src toolchain install-std
on my Mac (10.10 beta) when using either Homebrew Ruby 2.0.0 or system Ruby 2.0.0, but that could be due to 10.10 beta issues. If you are using another Ruby version manager (such as rbenv) or are not on the 10.10 beta, or aren't on Mac, you should be OK. Please post back if not.
The changes are in src
0.0.21. If you are using a downloaded binary, update to 0.0.21 by running src selfupdate
. Then run src version
to ensure you are on 0.0.21. Or if you built from source, just run go get -u sourcegraph.com/sourcegraph/srclib/cmd/src
.
works for me (sort of). I got a bunch of warnings and a couple of errors from yard, but that's probably yards fault?:
[error]: Unhandled exception in YARD::Handlers::C::OverrideCommentHandler:
[error]: in `ruby-2.1.2/math.c`:906:
906:
Files: 628
Modules: 274 ( 104 undocumented)
Classes: 1396 ( 536 undocumented)
Constants: 1187 ( 659 undocumented)
Methods: 7661 ( 1511 undocumented)
73.28% documented
OK! Installed/upgraded Ruby (sourcegraph.com/sourcegraph/srclib-ruby) toolchain
================================================================================
Does this look acceptable?
I'm on osx 10.9.4 and using rbenv btw
Yep, those YARD warnings are fine.
On Aug 18, 2014, at 23:39, David Elliott notifications@github.com wrote:
works for me (sort of). I got a bunch of warnings and a couple of errors from yard, but that's probably yards fault?:
[error]: Unhandled exception in YARD::Handlers::C::OverrideCommentHandler: [error]: in
ruby-2.1.2/math.c
:906:906:
Files: 628 Modules: 274 ( 104 undocumented) Classes: 1396 ( 536 undocumented) Constants: 1187 ( 659 undocumented) Methods: 7661 ( 1511 undocumented) 73.28% documented
OK! Installed/upgraded Ruby (sourcegraph.com/sourcegraph/srclib-ruby) toolchain
Does this look acceptable?
— Reply to this email directly or view it on GitHub.
@sqs sorry to be a bother but I'm still trying to confirm this is working now, maybe I'm just not using this correctly. I went ahead and installed the atom plugin and I can't get it to work. It only reports "No references in this file." or "No reference found under cursor." I'm viewing a rails project and it can't find info for any of the Framework's classes. Do I need to generate some tag files in my project directory or something?
No problem. Sorry for the trouble.
Did you set the correct path to src in the settings? Do you see any errors in the console? Check the console for the "src api describe ..." command it's running and try running it manually from your repo dir. What if you try it on a known good repo, such as sgtest/ruby-sample-0? Are you running src v0.0.20?
I'll check back tomorrow morning to see if any of these worked or yielded more troubleshooting info. Thanks for helping us work through these compatibility issues.
On Aug 19, 2014, at 00:01, David Elliott notifications@github.com wrote:
@sqs sorry to be a bother but I'm still trying to confirm this is working now, maybe I'm just not using this correctly. I went ahead and installed the atom plugin and I can't get it to work. It only reports "No references in this file." or "No reference found under cursor." I'm viewing a rails project and it can't find info for any of the Framework's classes. Do I need to generate some tag files in my project directory or something?
— Reply to this email directly or view it on GitHub.
I did set the path to src in the editor plugin settings When you say the console, I assume that you mean within the editor? I'm just seeing output such as:
Finding list of references in file: /usr/local/bin/src api list --file "/path/to/currently/open/file"
No references in this file.
running src v0.0.21
Can't install srclib-ruby without rvm? I'm using rbenv for ruby version management. Is this why I'm seeing the following error when trying to run
src toolchain install-std
I'm using ruby 2.1.2p95 by the way.Assuming that not having rvm installed is the problem I took a look at what it would take to be agnostic to a particular brand of ruby version management. At first glance it seems that rvm is pretty tightly coupled throughout the project. Would you advise against an effort to remove rvm as a required dependency if this is the case?