Skip to content

Fix compatibility with beta versions of Sprockets #1047

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

Merged
merged 1 commit into from
Dec 28, 2019
Merged

Fix compatibility with beta versions of Sprockets #1047

merged 1 commit into from
Dec 28, 2019

Conversation

patbl
Copy link
Contributor

@patbl patbl commented Dec 27, 2019

RubyGems made a change that causes this error when you're on a beta version of Sprockets 4:

/home/vagrant/code/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/react-rails-2.6.0/lib/react/jsx/sprockets_strategy.rb:40:in
`register_engine_with_mime_type': undefined method `register_engine' for Sprockets:Module (NoMethodError)

Here's the relevant commit:

rubygems/rubygems@9836549#diff-94d386526b8b558035d4e4c7602d647c

And here's how the behavior of Gemf::Version#<=> has changed:

Before:

1:(main)> `gem --version`
=> "3.0.3\n"
2:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.x')
=> true
3:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.a')
=> true

After:

1:(main)> `gem --version`
=> "3.1.2\n"
2:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.x')
=> false
3:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.a')
=> true

Sprockets 4.0 is out now, but this is still a bug, and people shouldn't be forced to upgrade because of it.

RubyGems made a change that causes this error when you're on a beta
version of Sprockets 4:

    /home/vagrant/code/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/react-rails-2.6.0/lib/react/jsx/sprockets_strategy.rb:40:in
    `register_engine_with_mime_type': undefined method `register_engine' for Sprockets:Module (NoMethodError)

Here's the relevant commit:
rubygems/rubygems@9836549#diff-94d386526b8b558035d4e4c7602d647c

And here's how the behavior of `Gemf::Version#<=>` has changed:

Before:

    1:(main)> `gem --version`
    => "3.0.3\n"
    2:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.x')
    => true
    3:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.a')
    => true

After:

    1:(main)> `gem --version`
    => "3.1.2\n"
    2:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.x')
    => false
    3:(main)> Gem::Version.new("4.0.0.beta9") >= Gem::Version.new('4.a')
    => true

Sprockets 4.0 is out now, but this is still a bug, and people shouldn't
be forced to upgrade because of it.
@BookOfGreg
Copy link
Member

Looks good, has tests, thank you for this gift :)

@BookOfGreg BookOfGreg merged commit b1a6cc0 into reactjs:master Dec 28, 2019
@aristocrates aristocrates deleted the require-correct-version-of-sprockets branch December 30, 2019 19:04
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

Successfully merging this pull request may close these issues.

2 participants