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

Add support for Rails 6 and 7, drop support for Rails 5 #128

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

rossta
Copy link
Owner

@rossta rossta commented Jul 22, 2024

Rails 5 is old news. This PR adds support for Rails 6 and 7 by updating the CI matrix. Circle CI integration stopped working awhile back, so I’ve also added Github Actions which supported running a matrix of tests against multiple versions of Ruby with multiple Gemfiles.

Ross Kaffenberger added 6 commits July 22, 2024 17:49
Also drops Appraisal dependency
Webpacker has been abandoned in the past few years. I might consider
leaving the Webpacker logic in the gem until a major version release,
but trying to upgrade development dependencies to get Webpacker to work
in CI isn’t worth my time.
Ross Kaffenberger and others added 4 commits July 22, 2024 18:30
Using Proc.new to implicitly capture a passed block was removed from
Ruby 3.0.
- cascading test failures caused when no application.js file found during install generator. Because javascript convention changes between major rails versions, generating new sample app no longer reliably places a file at app/assets/javascripts/application.js. Now the install generator will touch that location if detect_js_format falls through, though there may be a better way to do this.
rossta referenced this pull request Jul 23, 2024
- cascading test failures caused when no application.js file found during install generator. Because javascript convention changes between major rails versions, generating new sample app no longer reliably places a file at app/assets/javascripts/application.js. Now the install generator will touch that location if detect_js_format falls through, though there may be a better way to do this.
@marvindanig
Copy link

hi @rossta aside from failing tests is there a reason why we're holding this PR back from merge? I hope omakase-ing PWA in rails 7 wouldn't matter since this gem is a lot more popular. Thoughts?

@rossta
Copy link
Owner Author

rossta commented Sep 7, 2024

failing tests

Correct. I haven‘t had a chance to fix the tests but would welcome a patch.

@marvindanig
Copy link

marvindanig commented Sep 9, 2024

One issue that I envisage with the current PR is likely going to be with the sprockets dependency. Newer rails 7 apps that use propshaft cannot use this gem as is, because the sprockets engine will irk rails into not using propshaft.

i haven’t tested for this potential issue yet, but this has been the case with other gems that were using sprockets in my experience.

@marvindanig
Copy link

marvindanig commented Sep 10, 2024

yes, it fails at the $ rails g serviceworker:install step, but for another reason. Here's a fresh sample app using rails 7, propshaft, and a very basic frontend setup.

https://github.com/marvindanig/my_app

my_app git:(main) ✗ rails g serviceworker:install
/Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- rack/file (LoadError)
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.18/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/handlers/sprockets_handler.rb:3:in `<main>'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.18/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/handlers.rb:50:in `sprockets_handler'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/handlers.rb:28:in `handler_for_name'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/handlers.rb:40:in `resolve_handler'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/handlers.rb:10:in `build'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/bundler/gems/serviceworker-rails-7f3a612f4414/lib/serviceworker/middleware.rb:25:in `initialize'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:44:in `new'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:44:in `build'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:172:in `block in build'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:168:in `each'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:168:in `inject'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/stack.rb:168:in `build'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/engine.rb:521:in `block in app'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/engine.rb:517:in `synchronize'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/engine.rb:517:in `app'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/initializable.rb:32:in `run'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:350:in `each'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:350:in `call'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/application.rb:435:in `initialize!'
	from /Users/sonicaarora/Projects/my_app/config/environment.rb:5:in `<main>'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.18/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/application.rb:411:in `require_environment!'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command/actions.rb:20:in `boot_application!'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/commands/generate/generate_command.rb:21:in `perform'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command/base.rb:178:in `invoke_command'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command/base.rb:73:in `perform'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:71:in `block in invoke'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:149:in `with_argv'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:69:in `invoke'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.2.1/lib/rails/commands.rb:18:in `<main>'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/sonicaarora/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from bin/rails:4:in `<main>'

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.

3 participants