lib/tasks/application.rake
namespace :routes do
task :api => :environment do
Grape::API.subclasses.each do |subclass|
subclass.routes.each do |e|
puts "%-10s %-6s %-24s %s" % [subclass, e.route_method, e.route_path, e.route_description]
end
puts
end
end
end
$ rake routes:api
MyApi GET /api/action1 コメント1
MyApi PUT /api/action2 コメント2
MyApi DELETE /api/action3 コメント3
(snip)
・サブクラスすべてを表示する必要はないかも
・参照 https://github.com/search?type=Code&ref=searchresults&q=routes%20task%20grape
・Grape側でタスクが用意されてないので各自自作しているようです