fix(appengine): modernize rails-cloudsql gae flex ruby examples#1672
fix(appengine): modernize rails-cloudsql gae flex ruby examples#1672
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the Ruby Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request modernizes the rails-cloudsql examples for App Engine Flex by updating them to use Ruby 3.2 and the Ubuntu 22 operating system. The changes to the Gemfile and app.yaml files are appropriate for this goal. The CI configuration in .toys/kokoro-ci.rb is also updated to ensure these modernized examples are tested with the correct Ruby version. I have added a comment with a suggestion to improve the maintainability and readability of the CI script by refactoring repeated code.
| @products.delete_if do |dir| | ||
| dir.start_with?("appengine/") && | ||
| dir != "appengine/rails-cloudsql-postgres" && | ||
| dir != "appengine/rails-cloudsql-mysql" | ||
| end |
There was a problem hiding this comment.
This logic can be improved for readability and maintainability. The directory names are repeated from earlier in the file (lines 157-158) and the chained != checks are less clear than using Array#include?.
Consider defining the list of cloudsql directories as a constant or local variable at a higher scope, for example:
CLOUDSQL_DIRS = %w[
appengine/rails-cloudsql-postgres
appengine/rails-cloudsql-mysql
].freezeThen you could use it to simplify the logic in both places. Here, it would look like this:
@products.delete_if do |dir|
dir.start_with?("appengine/") && !CLOUDSQL_DIRS.include?(dir)
endAnd on lines 157-158, the deletion could be simplified to:
CLOUDSQL_DIRS.each { |dir| @products.delete dir }This would make the code DRY and easier to update.
Fixes #1671. Replaces and closes #1475 and #1477.