Hacker News new | ask | show | jobs
by kawsper 4613 days ago
It could be nice if Rubygems could show which gems that depends on a specific gem. I have a feeling that quite a lot depends on FFI.

I know that we depend on FFI, because we use selenium-webdriver, which depends on childprocess, which depends on FFI.

4 comments

I'm helping build Sourcegraph, which lists the gems that depend on FFI here:

https://sourcegraph.com/github.com/ffi/ffi/network/repos/in

and can show where some of its main methods are used: https://sourcegraph.com/github.com/ffi/ffi/symbols/ruby/gem/...

and also for some other gems:

https://sourcegraph.com/github.com/nex3/sass/network/repos/i...

https://sourcegraph.com/github.com/lsegal/yard/network/repos...

https://sourcegraph.com/github.com/rails/rails/network/repos...

It would be great if someone added this functionality to rubygems.org (npmjs.org has it: https://npmjs.org/browse/depended/request).

The Ruby support is very alpha right now. It works for some (but not all) popular gems, and it doesn't show transitive dependencies yet. Also, the list of dependents isn't comprehensive, but it should be a good starting point. If there are any specific gems you'd like to see dependents for, or any issues you see, let me know.

At a glance, there are perhaps 1400 gems that require or refer to ffi: https://www.google.ca/search?q=ffi+inurl:gemspec

But that's the type of site I was trying to find before I resorted to Google. I'd second that recommendation to add the functionality to rubygems.org ... Maybe we need a pull-request? :)

I will probably eventually submit a PR for this feature at https://github.com/rubygems/rubygems.org. If anyone else wants to get it started, I'd certainly help.
Had a play around on SG and it works really well; nice project. What JS framework, if any, are you using?
Thanks! We are using AngularJS with UI-Router and Backbone 3. The backend is in Go, with a native language component for each of the languages that we support (currently Python/Go/JavaScript/Ruby).
which lists the gems that depend on FFI

Are these only gems where the gem source code is in Github?

Pretty much (it also includes gems hosted on Bitbucket or Google Code).
Hmm. I was thinking it might be useful here: http://www.ruby-doc.org/gems/
Awesome site! It would be great if you added a link to Sourcegraph there. We're going to have language-specific homepages (sourcegraph.com/ruby) and I can let you know when that's ready if you would prefer to link to that.
What I was hoping was that for any given gem you could see, as part of the rendered docs, what other gems it relies on.

Basically, enhance the default docs that are generated by rdoc with additional information about the gem.

One-stop shopping, so to speak.

You can tell it for a given project by looking in Gemfile.lock. It shows all the gems you explicitly requested in your Gemfile, and what dependencies each one pulled in.

edit: assuming you're using Bundler, that is. If you're not, fix that first ;)

Is this a big problem for someone in your situation?

Can you not rely on childprocess (or selenium webdriver) to handle their own dependancies appropriately?

Well sure, from the same perspective, the way this usually works is someone will take over the project -- whoever "needs it the most when they discover an issue" -- and so it's not necessarily anyone's problem. That is, after all, the somewhat selfish nature of Open Source.

But I'd say this is a problem if one wants to ensure compatibility in Rubyland with other languages and processes on different environments, or that they're using the latest and most correct code for their situation.

This gets hairier if the gem forks on github, and you've multiple fixes in multiple branches ... Rubygems aren't really set up to deal with this. Bundler helps, though.

No, not really a problem for me, I would expect childprocess to change their dependencies if needed.

I guess the reason that I am a bit uncomfortable, is because FFI in particular feels very basic and fundamental.

There is a list of several gems depending on ffi ( https://www.ruby-toolbox.com/projects/ffi ), mostly system stuff: Popular gems depending on ffi childprocess, rb-inotify, rb-kqueue, rb-fchange, ethon, spoon, minitest-chef-handler, win32-process, libnotify, nfqueue, net-ping, rubypython, sys-cpu, sys-uname, gssapi