Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nokogiri dependency throws deprecation warnings in Ruby 2.4.0 #54

Closed
bovender opened this issue Jan 16, 2017 · 12 comments
Closed

Nokogiri dependency throws deprecation warnings in Ruby 2.4.0 #54

bovender opened this issue Jan 16, 2017 · 12 comments

Comments

@bovender
Copy link

The Gemspec requires Nokogiri:

s.add_dependency "nokogiri", "~> 1.6.3"

Which triggers tons of deprecation warnings with Ruby 2.4.0 because of the Fixnum/Bignum deprecation.

It's fixed in Nokogiri 1.7.0 (sparklemotion/nokogiri#1564).

Is it possible to relax the dependency?

@antstorm
Copy link
Contributor

@bovender sure, but it needs to be ruby version dependent, since Nokogiri 1.7 also dropped support for older rubies

@bovender
Copy link
Author

Ah ok, sure. Unfortunately I'm unable to help with that -- don't know enough about Gemspec dependencies.

@antstorm
Copy link
Contributor

No problem, I'll add this one

@antstorm
Copy link
Contributor

#55

@bovender
Copy link
Author

May I ask one more thing -- the ruby version-dependent dependency somehow does not work:

$ bundle update
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "nokogiri":
  In Gemfile:
    nokogiri (~> 1.7.0)

    eu_central_bank (~> 1.0) was resolved to 1.0.0, which depends on
      nokogiri (~> 1.6.3)
$ irb
irb(main):001:0> puts RUBY_VERSION
2.4.0
=> nil
irb(main):002:0> 

The RUBY_VERSION is 2.4.0, but the nokogiri dependency is not properly resolved.

Maybe this is not the right place to ask this, but maybe I'm just missing something simple.

@antstorm
Copy link
Contributor

So it says that eu_central_bank got resolved to 1.0.0, which is an older version. You want 1.1.0 for ruby 2.4.0 support.

@bovender
Copy link
Author

I really don't mean to be a nuisance, but the output is the same when I fix the version at 1.1.0 in the Gemfile. When I download the gem from RubyGems.org and extract the files, the metadata file contained in metadata.gz does not mention nokogiri 1.7.0:

    --- !ruby/object:Gem::Specification
    name: eu_central_bank
    version: !ruby/object:Gem::Version
      version: 1.1.0
    platform: ruby
    authors:
    - Shane Emmons
    autorequire: 
    bindir: bin
    cert_chain: []
    date: 2017-01-19 00:00:00.000000000 Z
    dependencies:
    - !ruby/object:Gem::Dependency
      name: nokogiri
      requirement: !ruby/object:Gem::Requirement
        requirements:
        - - ~>
          - !ruby/object:Gem::Version
            version: 1.6.3
      type: :runtime
      prerelease: false
      version_requirements: !ruby/object:Gem::Requirement
        requirements:
        - - ~>
          - !ruby/object:Gem::Version
            version: 1.6.3
      [...]

When I clone the repository and build the gem myself using Ruby 2.4.0, I find this inside the metadata file:

    --- !ruby/object:Gem::Specification
    name: eu_central_bank
    version: !ruby/object:Gem::Version
      version: 1.1.0
    platform: ruby
    authors:
    - Shane Emmons
    autorequire: 
    bindir: bin
    cert_chain: []
    date: 2017-01-25 00:00:00.000000000 Z
    dependencies:
    - !ruby/object:Gem::Dependency
      name: nokogiri
      requirement: !ruby/object:Gem::Requirement
        requirements:
        - - "~>"
          - !ruby/object:Gem::Version
            version: 1.7.0
      type: :runtime
      prerelease: false
      version_requirements: !ruby/object:Gem::Requirement
        requirements:
        - - "~>"
          - !ruby/object:Gem::Version
            version: 1.7.0
      [...]

Which makes me wonder if the RUBY_VERSION switch is really resolved at installation time, rather than packaging time.

@antstorm
Copy link
Contributor

@bovender sounds like you're right… and a quick search revealed the fact that it might be impossible to achieve. So it seems like we need to relax the dependency on the gem ('>= 1.6.3', '< 2.0'), allowing devs to pick the right one in their Gemfiles.

@ahukkanen
Copy link
Contributor

@antstorm Maybe just put it to readme that if you're using older Ruby < 2.4.0, use X version of this gem?

@antstorm
Copy link
Contributor

@ahukkanen it would make sense to drop the support of Ruby <= 2.0, yes, since it's what causing most of the issues right now. I wonder how many people are still running older rubies…

@ahukkanen
Copy link
Contributor

Yeah, that's true, too. I would guess not that many people.

@antstorm
Copy link
Contributor

I guess it's time to do that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants