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

Fix deprecation warnings in 3.5.0 #280

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

lylo
Copy link
Contributor

@lylo lylo commented Oct 9, 2023

Running Ruby 3.3.0-preview2 and Ruby Gems 3.5.0.dev I am seeing the following deprecation warning:

NOTE: Gem::Platform.match is deprecated; use Gem::Platform.match_spec? or match_gem? instead. It will be removed in Rubygems 4
Gem::Platform.match called from /Users/[me]/dev/tailwindcss-rails/lib/tailwindcss/commands.rb:37.

This patch replaces calls to Gem::Platform#match to Gem::Platform#match_gem? as recommended in the source.

This update passes nil as the second argument to match_gem?. The implementation of match_gem? appears to ignore the second argument (gem_name) and it's actually identical to the deprecated match method:

  def self.match(platform)
    match_platforms?(platform, Gem.platforms)
  end

  def self.match_gem?(platform, gem_name)
    # NOTE: this method might be redefined by Ruby implementations to
    # customize behavior per RUBY_ENGINE, gem_name or other criteria.
    match_platforms?(platform, Gem.platforms)
  end

@flavorjones
Copy link
Member

@lylo Ah, thank you so much for the PR! I hadn't seen these warnings yet. I'll take a look at the PR later today.

lib/tailwindcss/commands.rb Outdated Show resolved Hide resolved
lib/tailwindcss/commands.rb Outdated Show resolved Hide resolved
@flavorjones
Copy link
Member

flavorjones commented Oct 10, 2023

The user journey tests are failing for unrelated reasons ... I'm going to fix on main and will ask you to rebase when it's ready.

Update: if you rebase now, the user tests should pass.

lylo and others added 2 commits October 10, 2023 14:48
Although this argument isn't used in the CRuby implementation, other
implementations (specifically TruffleRuby) reserve the right to
re-implement this method with special cases for specific gems.

More context at rubygems/rubygems#3817
@flavorjones
Copy link
Member

@lylo Because I'd like to get a release out today with this and #281, I went ahead and made the small changes I requested in my review.

@lylo
Copy link
Contributor Author

lylo commented Oct 10, 2023

@lylo Because I'd like to get a release out today with this and #281, I went ahead and made the small changes I requested in my review.

No worries! Thank you for explaining the gem name param too 🙏

@flavorjones flavorjones merged commit 6f2e748 into rails:main Oct 10, 2023
20 checks passed
@flavorjones
Copy link
Member

https://github.com/rails/tailwindcss-rails/releases/tag/v2.0.31 is out! Thank you again!

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