rails / tailwindcss-rails

Other
1.39k stars 170 forks source link

v2.0.31 Fails on ruby 2.7.x #286

Closed tonyjoblin closed 10 months ago

tonyjoblin commented 10 months ago

PR https://github.com/rails/tailwindcss-rails/pull/280 replaces Gem::Platform#match to Gem::Platform#match_gem? This fixes deprecation warnings but breaks on ruby 2.7.? because match_gem? does not exist there (at least not on 2.7.3).

This causes errors like these:

bin/rails tailwindcss:watch
rails aborted!
NoMethodError: undefined method `match_gem?' for Gem::Platform:Class

Tasks: TOP => tailwindcss:watch

and

when running bin/rails s

ActionView::Template::Error (The asset "tailwind.css" is not present in the asset pipeline.
):
     5:     <meta name="viewport" content="width=device-width,initial-scale=1">
     6:     <%= csrf_meta_tags %>
     7:     <%= csp_meta_tag %>
     8:     <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
     9: 
    10:     <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    11:     <%= javascript_importmap_tags %>

app/views/layouts/application.html.erb:8

Work around

Update your gemfile to fix tailwindcss-rails to version 2.0.30 and run bundle update.

flavorjones commented 10 months ago

Thanks for reporting, I'll take a look as soon as I can.

flavorjones commented 10 months ago

So Gem::Platform#match_gem? was introduced in https://github.com/ruby/ruby/commit/4aca77ed / Rubygems v3.2.0 which was released with just before Ruby 3.0 on 2020-12-10.

I think we've got three options

  1. drop support for Ruby 2.7 in this gem
    • (which would be different from Rails's support matrix (this is not really an option))
  2. set required_rubygems_version to >= 3.2.0 in tailwindcss-rails.gemspec
    • which might break some people's container configurations, but maybe that's OK
  3. revert #280 until Rails drops support for Ruby 2.7

@rafaelfranca do you have an opinion between options 2 and 3 above?

rafaelfranca commented 10 months ago

2 is ok for me. Rubygems 3.2 supports 2.7, so people can just upgrade.

flavorjones commented 10 months ago

v2.0.32 has been released which fixes this.

gxespino commented 10 months ago

Indeed, this broke all of my heroku apps that are on the heroku-20 stack...

flavorjones commented 10 months ago

@gxespino I'm sorry, I don't understand. If 2.0.32 broke something please open a new issue.