Find out which gems require native c extensions from a Gemfile?
Asked Answered
D

2

10

I just recently started shifting attention towards deploying Ruby apps atop TorqueBox which of course is built atop Jruby. Hitherto I have been basically performing a bundle install and then tackling each gem along the way to jrubydom, but I've hit a couple gems that have taken me some considerable time to resolve due to needing to reimplement large portions of them.

Is there a way to invoke bundler or rubygems to run through all gems and their deps to test if they require native c extensions and then return such a list? It sure would be nice to tackle some of the more minor items or even to know if it is worthwhile to tackle a project in terms of moving it to jruby.

Dreibund answered 19/6, 2014 at 17:32 Comment(0)
C
5

You can use JRuby Lint for that. It will will check for some gems requiring C extension and even list alternative (based on this list).

Canonry answered 19/6, 2014 at 17:59 Comment(0)
P
11

Based on the fact that gems with native extensions usually have an /ext directory, I made a simple oneliner that finds these gems:

puts `bundle show --paths`.split("\n").select{|dep| File.directory?("#{dep}/ext") }.map{|dep| dep.split('/').last }.join(', ')

You can do this on the command line with this command:

$ bundle show --paths | ruby -e "STDIN.each_line {|dep| puts dep.split('/').last if File.directory?(File.join(dep.chomp, 'ext')) }"
Puseyism answered 14/9, 2015 at 14:45 Comment(0)
C
5

You can use JRuby Lint for that. It will will check for some gems requiring C extension and even list alternative (based on this list).

Canonry answered 19/6, 2014 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.