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

Update for Rails 8 #479

Merged
merged 12 commits into from
Oct 30, 2024
Merged

Update for Rails 8 #479

merged 12 commits into from
Oct 30, 2024

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Oct 9, 2024

Closes #468

There are two main things here:

  • I re-generated the dummy app with bundle exec rails plugin new then did some manual clean-up. There are more files than previously, but I think this is fine since otherwise we would need to clean these up on on every Rails update.

  • Due to Rails 8 changes, we now have to explictly eager load the routes.

I verified against code-db which is on Rails 7.2.

@andyw8 andyw8 added the chore Chore task label Oct 9, 2024
@andyw8 andyw8 force-pushed the andyw8/rails-8-beta branch 2 times, most recently from 4e7fb36 to b48958b Compare October 9, 2024 20:04
@andyw8 andyw8 marked this pull request as ready for review October 9, 2024 20:06
@andyw8 andyw8 requested a review from a team as a code owner October 9, 2024 20:06
@andyw8 andyw8 marked this pull request as draft October 9, 2024 20:08
.rubocop.yml Outdated
@@ -10,7 +10,7 @@ AllCops:
NewCops: disable
SuggestExtensions: false
Exclude:
- "test/dummy/db/**/*.rb"
- "test/dummy/**/*"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't care about styling in the dummy app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?

@andyw8 andyw8 force-pushed the andyw8/rails-8-beta branch 3 times, most recently from 99aa3ed to 7d83ae8 Compare October 28, 2024 19:06
@andyw8 andyw8 changed the title Update dummy app to Rails 8 Update for Rails 8 Oct 29, 2024
@@ -315,7 +315,7 @@ def index
uri = response[0].command.arguments.first.first

assert_match("GET /users(.:format)", response[0].command.title)
assert_match("config/routes.rb#L4", uri)
assert_match("config/routes.rb#L3", uri)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line number have changed because routes.rb no longer has # frozen_string_literal: true.

@@ -7,7 +7,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec

gem "puma"
gem "sqlite3", "< 2"
gem "sqlite3"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 was causing an issue with Rails 7 previously

@@ -17,7 +17,7 @@ gem "rubocop-sorbet", "~> 0.8", require: false
gem "sorbet-static-and-runtime", platforms: :ruby
gem "tapioca", "~> 0.13", require: false, platforms: :ruby
gem "psych", "~> 5.1", require: false
gem "rails"
gem "rails", "8.0.0.beta1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're up to RC2 now, but I will hold off updating until the proper release is out.

@andyw8 andyw8 force-pushed the andyw8/rails-8-beta branch 2 times, most recently from 4653631 to 4eb2491 Compare October 30, 2024 14:50
@andyw8 andyw8 marked this pull request as ready for review October 30, 2024 14:50
@andyw8
Copy link
Contributor Author

andyw8 commented Oct 30, 2024

I've marked this as Ready for Review, however there are 2 tests which are failing only in CI and I cannot figure out why 😭 .

@andyw8
Copy link
Contributor Author

andyw8 commented Oct 30, 2024

Ah, it's related to the config.eager_load = ENV["CI"].present? check in test.rb.

test/dummy/Rakefile Outdated Show resolved Hide resolved
test/dummy/app/controllers/application_controller.rb Outdated Show resolved Hide resolved
test/dummy/app/helpers/application_helper.rb Outdated Show resolved Hide resolved
test/dummy/app/models/application_record.rb Outdated Show resolved Hide resolved
test/dummy/bin/dev Outdated Show resolved Hide resolved
test/dummy/config/environments/production.rb Outdated Show resolved Hide resolved
test/dummy/config/environments/test.rb Outdated Show resolved Hide resolved
test/dummy/config/initializers/inflections.rb Outdated Show resolved Hide resolved
test/dummy/public/400.html Outdated Show resolved Hide resolved
.rubocop.yml Outdated
@@ -10,7 +10,7 @@ AllCops:
NewCops: disable
SuggestExtensions: false
Exclude:
- "test/dummy/db/**/*.rb"
- "test/dummy/**/*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?

@andyw8
Copy link
Contributor Author

andyw8 commented Oct 30, 2024

My original intention was to have keep the dummy app as unchanged as possible, so as to minimize the work needed when regenerating it, but we can stick with the current approach.

@@ -186,8 +186,8 @@ def baz; end
URI::Generic.from_path(path: File.join(dummy_root, "config", "routes.rb")).to_s,
response[0].uri,
)
assert_equal(3, response[0].range.start.line)
assert_equal(3, response[0].range.end.line)
assert_equal(4, response[0].range.start.line)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line numbers changed because the generated routes.rb has a new comment.

@@ -1,5 +0,0 @@
# typed: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just noticed this was unintentionally removed, looking into whether to restore)

@andyw8
Copy link
Contributor Author

andyw8 commented Oct 30, 2024

Re-verified against code-db and Core with the latest changes.

@andyw8 andyw8 enabled auto-merge (squash) October 30, 2024 18:40
@andyw8 andyw8 merged commit b5f4791 into main Oct 30, 2024
28 checks passed
@andyw8 andyw8 deleted the andyw8/rails-8-beta branch October 30, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update dummy app to Rails 8
2 participants