0
我想在Opinio gem中启用对Inherited Resources gem的支持,但是我需要检测项目中是否使用了继承资源。如何检测rails项目中的gem使用情况?
我已经看过Bundler的文档以找到关于宝石使用情况检测的内容,但是我什么也没找到。你能推荐我一些东西吗?
我想在Opinio gem中启用对Inherited Resources gem的支持,但是我需要检测项目中是否使用了继承资源。如何检测rails项目中的gem使用情况?
我已经看过Bundler的文档以找到关于宝石使用情况检测的内容,但是我什么也没找到。你能推荐我一些东西吗?
您可以测试是否存在InheritedResources
宝石的模块。
begin
Module.const_get('InheritedResources')
# made it here? InheritedResources is included
rescue NameError => e
# InheritedResources is not included
end
也许最好在你的gemspec中包含一个〜>版本的声明?例如's.add_dependency(“inherited_resources”,“〜> 1.3”)'。或者你可以尝试要求,并从'LoadError'救援 – 2012-07-10 22:44:23