如何使我的Ruby Gem在安装过程中自动安装本机APT软件包?
我正在构建自己的Ruby Gem,我们称其为my-gem
,它取决于某些系统软件包,例如gpsbabel
。它希望能够使用Shell调用gpsbabel
命令。
在Ubuntu上,在运行my-gem
之前,我必须确保通过gpsbabel
是通过apt aint install gpsbabel
安装的。
RubyGems中是否有功能,或者可能由其他一些宝石提供的功能可以自动化?因此,当我运行GEM安装my-gem
时,可以确保安装gpsbabel
,如果没有,则自动安装了?
I'm building my own ruby gem, let's call it my-gem
, which depends on some system package, for example gpsbabel
. It expects to be able to call gpsbabel
command using the shell.
On Ubuntu, before running my-gem
, I have to make sure that gpsbabel
is installed via apt install gpsbabel
.
Is there a feature in rubygems, or maybe supplied by some other gems, that automates that? So that when I run gem install my-gem
, it's ensured that gpsbabel
is installed, and if not, it's installed automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是100%确定您的要求是不可能的,但是我无论如何都不会推荐它:
APT
仅适用于Debian/Ubuntu Systems,理想情况下是宝石跨平台友好,因此不做任何特定于平台的事情。当然,如果您只用自己的使用来供自己使用,那也许是可行的?但是,我取而代之的是,在
bundle install install
之前,要为安装所需软件包的相关应用程序设置脚本。I'm not 100% certain that what you're asking for is impossible, but I wouldn't recommend it anyway:
apt
would only be appropriate for Debian/Ubuntu systems, and ideally a gem would be cross-platform-friendly and thus not do anything platform-specific.Granted, if you're making a gem for your own use only, then maybe it's viable? But I'd instead be looking at having a set-up script for the the relevant applications that installs the required packages before
bundle install
.