如何获取已安装的具有本机扩展的 gem 列表? [英] How do I get a list of gems that are installed that have native extensions?
问题描述
我在 Windows 上,已从 ruby 1.8.x 更新到 1.9.x,现在收到错误弹出窗口,抱怨 ruby-mssomethingrt.1.8.x.dll 丢失.
I'm on windows, and have updated from ruby 1.8.x to 1.9.x, and am now getting error popups that complain ruby-mssomethingrt.1.8.x.dll is missing.
我想找出哪些 gem 有原生扩展,所以我可以卸载它们并在安装期间再次在本地强制重建原生扩展,以消除错误.
I would like to find out which gems have native extensions, so I can uninstall them and force a rebuild of the native extensions locally during installation again, to make the error go away.
推荐答案
一个好的开始是查看每个 gem 的 gem 规范,看看它是否有 extensions 字段集.这应该会给您留下一个要重新安装的 gem 的简短列表.它们不一定都使用原生扩展,但如果您查看相应的 extconf.rb
文件,应该很容易找到.
A good start would be to look at the gem specification for each gem and see if it has the extensions field set. That should leave you with a short-list of gems to re-install. They don't necessarily all use native extensions, but if you look at the corresponding extconf.rb
files, this should be pretty easy to find out.
更新:这是列出这些宝石的简短 ruby 脚本:
Update: Here is a short ruby script to list those gems:
require 'rubygems'
Gem.source_index.each do |gem|
spec = Gem.source_index.specification(gem[0])
ext = spec.extensions
puts "#{gem[0]} has extensions: #{ext}" unless ext.empty?
end
这篇关于如何获取已安装的具有本机扩展的 gem 列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!