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.
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).
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')) }"
来源:https://stackoverflow.com/questions/24312872/find-out-which-gems-require-native-c-extensions-from-a-gemfile