sourcegraph / srclib-ruby

https://sourcegraph.com/sourcegraph/srclib-ruby
9 stars 9 forks source link

Can't install without RVM? #1

Open taboularasa opened 10 years ago

taboularasa commented 10 years ago

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.

rvm fetch ruby-2.1.2
make: rvm: No such file or directory
make: *** [stdlib] Error 1
failed to install/upgrade Ruby (sourcegraph.com/sourcegraph/srclib-ruby) toolchain: command ["make" "-C" "/Users/david/.srclib/sourcegraph.com/sourcegraph/srclib-ruby"] failed: exit status 2

Tip: If you are using a version of Ruby other than 2.1.2 (the default for srclib), rerun this command with 'rvm x.y.z do src toolchain install-std', where x.y.z is your preferred Ruby version.

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?

sqs commented 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.

taboularasa commented 10 years ago

@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?

sqs commented 10 years ago

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.

taboularasa commented 10 years ago

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

sqs commented 10 years ago

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.

taboularasa commented 10 years ago

@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?

sqs commented 10 years ago

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.)

sqs commented 10 years ago

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.

taboularasa commented 10 years ago

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?

taboularasa commented 10 years ago

I'm on osx 10.9.4 and using rbenv btw

sqs commented 10 years ago

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.

taboularasa commented 10 years ago

@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?

sqs commented 10 years ago

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.

taboularasa commented 10 years ago

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