rspreadsheet icon indicating copy to clipboard operation
rspreadsheet copied to clipboard

Bundler doesn't detect libxml-ruby as a transitive dependency on macOS

Open dmolesUC opened this issue 3 years ago • 0 comments

Steps to reproduce:

  1. on macOS, create a new Ruby project with rspreadsheet as a dependency in the Gemfile.
  2. 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:

  1. if I download the .gem file from RubyGems, untar it, and gunzip metadata.gz, libxml-ruby doesn't appear.

  2. If I instead clone the source and build locally (gem build rspreadsheet.gemspec) on my Mac, the resulting metadata 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.

dmolesUC avatar Feb 18 '21 21:02 dmolesUC