rails / tailwindcss-rails

Other
1.39k stars 170 forks source link

Fix deprecation warnings in 3.5.0 #280

Closed lylo closed 11 months ago

lylo commented 11 months ago

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 commented 11 months ago

@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.

flavorjones commented 11 months ago

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.

flavorjones commented 11 months ago

@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 commented 11 months ago

@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 commented 11 months ago

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