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.

ylluminate
  • 12,102
  • 17
  • 78
  • 152

2 Answers2

12

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')) }"
Schneems
  • 14,918
  • 9
  • 57
  • 84
user3592693
  • 181
  • 2
  • 4
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).

Martin
  • 7,634
  • 1
  • 20
  • 23