-
Notifications
You must be signed in to change notification settings - Fork 661
Rails 8 support #1046
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
Closed
Closed
Rails 8 support #1046
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ruby 2.7.3 | ||
ruby 3.4.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require_relative './helpers' | ||
require_relative 'helpers' | ||
|
||
module AnnotateRoutes | ||
class HeaderGenerator | ||
|
@@ -16,7 +16,7 @@ def generate(options = {}) | |
private | ||
|
||
def routes_map(options) | ||
result = `rake routes`.chomp("\n").split(/\n/, -1) | ||
result = `rake routes`.chomp("\n").split("\n", -1) | ||
|
||
# In old versions of Rake, the first line of output was the cwd. Not so | ||
# much in newer ones. We ditch that line if it exists, and if not, we | ||
|
@@ -29,7 +29,7 @@ def routes_map(options) | |
# Skip routes which match given regex | ||
# Note: it matches the complete line (route_name, path, controller/action) | ||
if regexp_for_ignoring_routes | ||
result.reject { |line| line =~ regexp_for_ignoring_routes } | ||
result.grep_v(regexp_for_ignoring_routes) | ||
else | ||
result | ||
end | ||
|
@@ -44,18 +44,16 @@ def initialize(options, routes_map) | |
def generate | ||
magic_comments_map, contents_without_magic_comments = Helpers.extract_magic_comments_from_array(routes_map) | ||
|
||
out = [] | ||
|
||
magic_comments_map.each do |magic_comment| | ||
out << magic_comment | ||
out = magic_comments_map.map do |magic_comment| | ||
magic_comment | ||
end | ||
out << '' if magic_comments_map.any? | ||
Comment on lines
+47
to
49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
out << comment(options[:wrapper_open]) if options[:wrapper_open] | ||
|
||
out << comment(markdown? ? PREFIX_MD : PREFIX) + timestamp_if_required | ||
out << (comment(markdown? ? PREFIX_MD : PREFIX) + timestamp_if_required) | ||
out << comment | ||
return out if contents_without_magic_comments.size.zero? | ||
return out if contents_without_magic_comments.empty? | ||
|
||
maxs = [HEADER_ROW.map(&:size)] + contents_without_magic_comments[1..-1].map { |line| line.split.map(&:size) } | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of
.sort
here might introduce non-deterministic load order for files.Dir.glob
doesn't guarantee any specific order for the files returned; it's dependent on the filesystem. By sorting the files, the previous implementation ensured a consistent load order, which can be crucial to prevent issues related to load order dependencies (e.g.,uninitialized constant
errors). If the order does not matter, this is fine, but if it does, it would be safer to reintroduce.sort
.