rspreadsheet
rspreadsheet copied to clipboard
Bundler doesn't detect libxml-ruby as a transitive dependency on macOS
Steps to reproduce:
- on macOS, create a new Ruby project with
rspreadsheet
as a dependency in the Gemfile. - run
gem dependency -R rspreadsheet
Expected:
-
libxml-ruby
appears as a dependency
Actual:
Gem rspreadsheet-0.5.3
andand (>= 1.3)
bundler (>= 1.5, < 3, development)
coveralls (>= 0.7, development)
pry-nav (>= 0.0, development)
rake (~> 0.9, development)
rspec (>= 2.0, development)
rubyzip (>= 1.3)
Hypothesis:
I see the code in the gemspec that's meant to check whether libxml-ruby
is already installed. I don't know enough about Bundler or Rubygems internals, but I believe (and this StackOverflow answer suggests) that the gemspec is only evaluated at gem build time, not later at install.
Circumstantial evidence:
-
if I download the
.gem
file from RubyGems, untar it, and gunzipmetadata.gz
,libxml-ruby
doesn't appear. -
If I instead clone the source and build locally (
gem build rspreadsheet.gemspec
) on my Mac, the resultingmetadata
file includes this:name: libxml-ruby requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '3.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '3.0'
Thoughts
-
It's possible there's some way to get this to work as a gem extension, but I don't know it's worth the effort. Possibly looking at the way Nokogiri does it would be fruitful?
-
My guess is this also explains #46.