Use `rails routes` instead of `rake routes`, minimum rails is now 5.0
This fixes https://github.com/ctran/annotate_models/issues/696 Major version bump is required because of minimum rails >= 5.0
Doesn't work for me on Ruby 2.6.6 and Rails 6.1.
rake aborted!
Don't know how to build task 'routes' (See the list of available tasks with `rake --tasks`)
/Users/heaven/.rvm/gems/ruby-2.6.6@lively-letters/bin/ruby_executable_hooks:22:in `eval'
/Users/heaven/.rvm/gems/ruby-2.6.6@lively-letters/bin/ruby_executable_hooks:22:in `<main>'
(See full trace by running task with --trace)
config/routes.rb unchanged.
this one works with rails 6.1.0.rc
Are there any plans to cut a release with this PR? annotate_routes doesn't work on Rails 6.2.
Bumping again as I have my gemfile pegged to @Vasfed 's fork on the rails6_warning branch.
@ctran please

Rebased onto current develop, test seem to fail because of run order and not the changes
This works great for me! Not sure why the CI is failing. I also tried replacing rake routes with rails routes, and it works fine for me.
I prefer not to add forked gems to my Gemfile since they don't get updated by dependabot. So I just added a monkey patch for this method to lib/monkey_patches/annotate_routes.rb:
# frozen_string_literal: true
if Rails.env.development?
if Annotate.version != '3.2.0'
raise "annotate has been updated to version #{Annotate.version}! " \
"Check if the 'rails routes' patch is still needed, or if this PR has been merged: " \
'https://github.com/ctran/annotate_models/pull/843'
end
module AnnotateRoutes
class HeaderGenerator
class << self
private
# UPDATE: Changed `rake routes` to `rails routes`
def routes_map(options)
result = `rails 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
# keep the line around.
result.shift if result.first =~ %r{^\(in /}
ignore_routes = options[:ignore_routes]
regexp_for_ignoring_routes = ignore_routes ? /#{ignore_routes}/ : nil
# 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 }
else
result
end
end
end
end
end
end
Route annotation is broken until this is addressed @ctran ! How can the community help maintain this library? I've helped in the past (long, long ago, in a galaxy far away) and would be happy to help out again! I love this tool!
I need help getting CI to work if you can spare some time. I was attempting to set up gitpod env but ran into few issues and haven't had time to continue.
I was able to add a task that solved this for me:
lib/tasks.routes.rake
task :routes do
puts `bin/rails routes`
end
This injects the rails routes behavior into the rake implementation that the gem is currently looking for.
@ctran looks like the CI issues have been resolved now so hopefully this is good to go - is there anything else that could be done to help you with shipping this?