Giter Site home page Giter Site logo

srclib-ruby's Introduction

srclib-ruby Build Status

YARD

srclib-ruby uses Loren Segal's YARD for Ruby analysis. A git subtree of the Sourcegraph fork of YARD is in the yard/ subdirectory. Commits to that subtree should be regularly sent upstream to the github.com/sourcegraph/yard fork.

Running tests

The make test target analyzes sample repositories in testdata/case and checks that the actual output matches the expected output (which is committed to the repository).

The sample repositories are git submodules, so you'll have to git submodule init && git submodule update the first time you want to run the tests.

The output of the analyzer differs a bit depending on the version of Ruby you have installed. The expected output was generated using Ruby 2.2.2. If you're finding that your output differs from the expected, try both generating the stdlib index and running the tests with that version of Ruby. If you're using rvm, this means running the following commands:

# in case you built the stdlib index using a different version of Ruby (e.g.,
# your system Ruby)
rm -rf ruby-2.2.2/.yardoc

# rebuild the stdlib index using Ruby 2.2.2 (run `rvm install 2.2.2` if you
# haven't already installed Ruby 2.2.2)
rvm 2.2.2 do make stdlib

# install gem deps for the test repos using Ruby 2.2.2
rvm 2.2.2 do make test-dep

# run the tests with Ruby 2.2.2
rvm 2.2.2 do make test

The same applies when you're generating new expected test output (after making an improvement to the code, for example).

If you're having trouble getting your output to match the expected, post an issue.

Using srclib-ruby in Windows/Cygwin environment

Windows with Cygwin installed is required as a prerequisite. srclib-ruby has been tested with:

CYGWIN_NT-6.1-WOW Diana 2.0.4(0.287/5/3) 2015-06-09 12:20 i686 Cygwin

Windows installation instructions

  • Download and install Ruby 2.2.2 using RubyInstaller. The x64 version has worked successfully. Make sure that ruby.exe is included in your path.
  • Download the Development Kit from RubyInstaller. The x64 version is known to work successfully. Extract the self-extracting archive somewhere (say C:\rbdevkit) and switch to this directory.
  • Run ruby dk.rb init to generate config.yml.
  • Edit config.yml and add a line like - RUBY-INSTALLATION-DIR. For example, - C:/ruby22-x64.
  • Run ruby dk.rb install..
  • Run gem install bundler -v 1.6.9. Using 1.6.x is important because srclib-ruby is supposed to work with 1.6.x.
  • Run gem install gem-exefy. This tool replaces .bat files in RubyInstaller with .exe. Ensure that you have installed DevKit as described above. Otherwise, gem won't work.
  • Run gem exefy --all to convert .bat files to .exe in RubyInstaller (for example, it will create bundle.exe and remove bundle.bat
  • Now, you are ready to run make in your srclib-ruby directory. It will take some time while Ruby downloads required files and then Yard builds the cache of Ruby 2.2.2 files.

Issue with OpenSSL

Ruby may not provide a default OpenSSL certificate authorities file. Thus, srclib-ruby may unable to communicate with external sites. Here is the workaround - see The Manual Way there.

TODO

  • Check whether Ruby stdlib works
  • Check whether xrefs work
  • Add Travis-CI test for src test test cases and YARD specs

srclib-ruby's People

Contributors

alexsaveliev avatar beyang avatar dlackty avatar jsyeo avatar rameshvarun avatar sqs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

srclib-ruby's Issues

Questions

1.) I noticed on the docs it mentions that Repo repo.URI can be filled out by the src tool. However, Globs []string is not created srclib-ruby and is filled in by the src tool. Is this just a missing note in the documentation?

2.) Why not use the Gemfile.lock instead of the Gemfile if you’re going to ignore the gemspec? (See srclib-ruby/lib/srclib-ruby/scan.rb#L37) Using the Gemfile.lock would give you more info (like exact version of the dependency) and avoid issues with arbitrary code being run by Gemfiles. You can read a Gemfile.lock using something like this:

lockfile = Bundler::LockfileParser.new(Bundler.read_file(‘Gemfile.lock’))

For a bit more context, a ruby gem specifies its dependencies in a gemspec and ruby application specifies it in the Gemfile. The Gemfile.lock is checked into version control for a ruby application and left out for a ruby gem. More info here: http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/ - I can also send a PR if you’re interested.

3.) In reference to a TreePath, what is a ghost component? (I understood the regex but didn’t see any components prefixed with -).

4.) Some fields are missing in the grapher def output (SID, DefKey, Callable, Test) that were mentioned in the docs https://srclib.org/toolchains/grapher-output/ . Are they optional?

5.) I noticed that Exported is noted in thead docs but its behavior isn’t documented. What does it mean to be Exported?

6.) The DefStart and DefEnd seem to correspond with the length of the definition. How does Start and End correspond with the Refs?

7.) Some fields are missing in the grapher refs output (CommitID, UnitType, Unit) that were mentioned in the docs. Are they optional?

8.) It seems like a lot of the heaving lifting in srclib-ruby/lib/srclib-ruby/graph.rb is being done by YARD and Graph transforms this data into something usable by Sourcegraph. Does this sound right to you?

9.) When you call yard bundle —list, what is list doing? In srclib-ruby/yard/lib/yard/cli/bundle.rb, add_gems expects a list of gems but I’m not seeing where the gems are being passed. How does it get the gems?

Srclib-ruby can't find yard/bin

I installed srclib-ruby from source using gem build and gem install. I've been experimenting with the CLI and it seems to be working fine except for graph.

λ →  srclib-ruby graph < unit.json
Using yard bin at '/Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard'
Running yard bundle...
/Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/lib/srclib-ruby/graph.rb:66:in ``': No such file or directory - /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard (Errno::ENOENT)
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/lib/srclib-ruby/graph.rb:66:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/.bin/srclib-ruby:35:in `<top (required)>'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/bin/srclib-ruby:23:in `load'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/bin/srclib-ruby:23:in `<main>'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

The problem is when srcgraph-lib is installed, it only includes srcgraph/lib. A simple fix would be to change the following lines in the gemspec (I think it might be easier to package yard-fork as its own gem and add it as a runtime dependency).

  spec.files += Dir.glob("{.bin,lib,spec}/**/*.rb") + Dir.glob("{yard/bin,yard/lib}/**/*")
  spec.require_paths = ['lib', 'yard/lib', 'yard/bin']

However, this returns new errors in the warning:

Using yard bin at '/Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard'
Running yard bundle...
/Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.1.1 in any of the sources (Bundler::GemNotFound)
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `map!'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `materialize'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/environment.rb:22:in `specs'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:50:in `add_gems'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:74:in `optparse'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:20:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command.rb:13:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command_parser.rb:73:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command_parser.rb:55:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard:12:in `<main>'

Getting yard bundle output dirs...
/Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.1.1 in any of the sources (Bundler::GemNotFound)
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `map!'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `materialize'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/environment.rb:22:in `specs'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:50:in `add_gems'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:74:in `optparse'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/bundle.rb:20:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command.rb:13:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command_parser.rb:73:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/cli/command_parser.rb:55:in `run'
        from /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard:12:in `<main>'
 ==> []
Running /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/bin/yard condense  ./.gemtest ./.gitignore ./.rspec ./.rubocop.yml ./.travis.yml ./.yardopts ./Gemfile ./LICENSE.md ./README.md ./Rakefile ./lib/open_civic_data.rb ./lib/open_civic_data/client.rb ./lib/open_civic_data/connection.rb ./lib/open_civic_data/request.rb ./lib/open_civic_data/version.rb ./open_civic_data.gemspec ./spec/fixtures/bills.json ./spec/fixtures/divisions.json ./spec/fixtures/events.json ./spec/fixtures/jurisdictions.json ./spec/fixtures/organizations.json ./spec/fixtures/people.json ./spec/fixtures/votes.json ./spec/helper.rb ./spec/open_civic_data/client_spec.rb ./spec/open_civic_data_spec.rb ./spec/support/custom_expectations/write_expectations.rb
[warn]: Loading main yardoc file at .yardoc
[warn]: Finished loading from aux yardoc files
[warn]: Syntax error in `.gitignore`:(1,2): syntax error, unexpected '.', expecting '='
[warn]: ParserSyntaxError: syntax error in `.gitignore`:(1,2): syntax error, unexpected '.', expecting '='
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `.rspec`:(2,14): syntax error, unexpected tidentifier, expecting keyword_do or '{' or '('
[warn]: ParserSyntaxError: syntax error in `.rspec`:(2,14): syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `.rubocop.yml`:(1,8): syntax error, unexpected ':', expecting end-of-input
[warn]: ParserSyntaxError: syntax error in `.rubocop.yml`:(1,8): syntax error, unexpected ':', expecting end-of-input
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `.travis.yml`:(1,15): syntax error, unexpected ':', expecting end-of-input
[warn]: ParserSyntaxError: syntax error in `.travis.yml`:(1,15): syntax error, unexpected ':', expecting end-of-input
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `.yardopts`:(1,17): syntax error, unexpected tidentifier, expecting keyword_do or '{' or '('
[warn]: ParserSyntaxError: syntax error in `.yardopts`:(1,17): syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `license.md`:(3,18): syntax error, unexpected tinteger, expecting end-of-input
[warn]: ParserSyntaxError: syntax error in `LICENSE.md`:(3,18): syntax error, unexpected tINTEGER, expecting end-of-input
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `readme.md`:(3,15): syntax error, unexpected tconstant, expecting keyword_do or '{' or '('
[warn]: ParserSyntaxError: syntax error in `README.md`:(3,15): syntax error, unexpected tCONSTANT, expecting keyword_do or '{' or '('
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/bills.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/bills.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/divisions.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/divisions.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/events.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/events.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/jurisdictions.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/jurisdictions.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/organizations.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/organizations.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/people.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/people.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Syntax error in `spec/fixtures/votes.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: ParserSyntaxError: syntax error in `spec/fixtures/votes.json`:(1,8): syntax error, unexpected ':', expecting =>
[warn]: Stack trace:
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:542:in `on_parse_error'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:50:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:439:in `parse'
        /Users/sunnyjuneja/.rvm/gems/ruby-2.1.2/gems/srclib-ruby-0.0.1/yard/lib/yard/parser/source_parser.rb:44:in `block in parse'

[warn]: Invalid tag format for @example
[warn]: Invalid tag format for @example
[warn]: Type inference: processing void_stmt at .gemtest line 2..2 (0 nodes seen)
[warn]: Type inference: processing list at spec/helper.rb line 13..13 (500 nodes seen)
[warn]: Type inference: processing list at spec/support/custom_expectations/write_expectations.rb line 61..64 (1000 nodes seen)
[warn]: add_type_to_abstract_value MAX_DEPTH exceeded (26), not adding type
[warn]: add_type_to_abstract_value MAX_DEPTH exceeded (26), not adding type
============ STATS ============
# STATS OMITTED FOR BREVITY 

Don't create new process

Right now, script_deps creates a new process by running gem list. You can get the same results without creating a new process by running Gem::Specification which responds to #each, #map, and #all. The upside is that every member of the collection responds to #version so you don't have to parse the results of gem list. The downside is that you can have multiple versions and they appear in the collection for every installed version.

#srclib-ruby/lib/srclib-ruby/scan.rb#L116-133
def script_deps(script_code)
  # Get a list of all installed gems
  installed_gems = `gem list`.split(/\n/).map do |line|
    line.split.first.strip #TODO: Extract version number
  end

  deps = []
  script_code.scan(/require\W["'](.*)["']/) do |required|
    if installed_gems.include? required[0].strip
      deps << [
        required[0].strip,
        ">= 0" #TODO: Should use the currently installed version number
      ]
    end
  end

  return deps
end

Can't install without RVM?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.