Find out which stones require native c extensions from Gemfile?

I recently started paying attention to deploying Ruby applications on top TorqueBox, which, of course, is built on top of Jruby. So far I have mainly performed bundle installand then dealt with every pearl on the way to jrubydom, but I hit a couple of precious stones that took me some considerable time to resolve due to the need to remake large parts of them.

Is there a way to call bundler or rubygems to run all the gems and their depots to check if they require native c extensions and then return such a list? Of course, it would be nice to tackle some of the smaller items or even know if the project is worth solving in terms of moving it to jruby.

+4
source share
2 answers

You can use JRuby Lint for this. He will test some stones that require a C extension and even a list of alternatives (based on this list ).

+4
source

Based on the fact that stones with native extensions usually have a / 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')) }"
+5
source

Source: https://habr.com/ru/post/1545274/


All Articles