What's the best way to list a non-ruby depende

2019-07-03 15:10发布

问题:

I am writing a ruby gem that I would like to use an open source program distributed as python. I don't have the time to port the python program to ruby, and I want to manage the external dependency as automatically as possible.

I'm thinking of using the Gem.pre_install hook to automatically easy_install the python package I'm interested in.

http://rubygems.rubyforge.org/rubygems-update/Gem.html#method-c-pre_install

I'd appreciate suggestions of better ways, or support of pre_install, if it's the accepted practice.

回答1:

Quite an old question, but worth a reply. Sorry, I haven't been checking stackoverflow for babushka-related questions :)

If the python package is available as a pip, then you could do something like this:

dep 'blah.gem' do
  requires 'something.pip'
end

dep 'something.pip'

Then, babushka blah.gem would handle the install, including installing rubygems and pip as required.

  • Ben


回答2:

You may want to look at Babushka for describing non-ruby dependencies.

I don't know whether installing the python package in the pre_install hook would be polite behaviour.