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

v2.0.31 Fails on ruby 2.7.x #286

Closed
tonyjoblin opened this issue Oct 25, 2023 · 6 comments · Fixed by #289
Closed

v2.0.31 Fails on ruby 2.7.x #286

tonyjoblin opened this issue Oct 25, 2023 · 6 comments · Fixed by #289

Comments

@tonyjoblin
Copy link

tonyjoblin commented Oct 25, 2023

PR #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.

@tonyjoblin tonyjoblin changed the title Fails on ruby 2.7.x v2.0.31 Fails on ruby 2.7.x Oct 25, 2023
@flavorjones
Copy link
Member

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

@flavorjones
Copy link
Member

So Gem::Platform#match_gem? was introduced in ruby/ruby@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 Fix deprecation warnings in 3.5.0 #280 until Rails drops support for Ruby 2.7

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

@rafaelfranca
Copy link
Member

rafaelfranca commented Oct 27, 2023

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

@flavorjones
Copy link
Member

v2.0.32 has been released which fixes this.

@gxespino
Copy link

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

@flavorjones
Copy link
Member

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

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 a pull request may close this issue.

4 participants