0

I cannot figure out how to make bundler to install platform-dependent gems.

As recommended in bundler docs I use :platforms option in the Gemfile:

# Gemfile
gem "pry-byebug", platforms: [:mri_20, :mri_21]
gem "pry-debugger", platforms: :mri_19

And I don't include the dependencies to my_gem.gemspec, 'cause it doesn't provide tools for platform-dependent specification.

When I run bundle all is OK: the corresponding gem is included to the Gemfile.lock as expected.

The problem arises when I use my gem in another ("host") gem.

When I run bundle in the host gem root, the platform-specific dependencies are skipped and missing in the host_gem/Gemfile.lock.

It seems like Bundler installs only dependencies specified in the gemspec, not in the Gemfile.

So my question is how to properly define platform-specific dependencies to be loaded by depending gems?

Andrew Kozin
  • 1,012
  • 9
  • 17

0 Answers0