是否可以为公式设置ruby gem依赖项?
文档中有一段关于它的内容,但没有进一步解释:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md#specifying-gems-python-modules-go-projects-etc-as-dependencies
答案 0 :(得分:0)
好的,通过this formula和this gem的组合找到了一个解决方案,第一个项目似乎是共同使用的。
它的长短不一,是每个gem的资源,安装到目录,更新脚本GEM_HOME
以便它们可以找到它们:
class GemDependentProject < Formula
#...cut
resource 'aws-sdk' do
url 'https://rubygems.org/gems/aws-sdk-2.6.29.gem'
sha256 '686ecaf63713d7a123cdfb1d746cc660236b6c8c3ac0b4f12b56479fa0542f06'
end
def install
prefix.install 'bin', 'lib'
resources.each do |r|
r.verify_download_integrity(r.fetch)
system("gem", "install", r.cached_download, "--no-document",
"--install-dir", "#{lib}/gem-dependent-project/vendor")
end
(bin/"gem-dependent-project-script").write(init_script)
end
def init_script
<<-EOS.undent
export GEM_HOME="#{HOMEBREW_PREFIX}/lib/gem-dependent-project/vendor"
# Continue as normal...
EOS
end
#... cut
end