Created
August 29, 2018 15:59
-
-
Save nbarthelemy/18b3d000a6d834df3884eb7d5cf1cd0a to your computer and use it in GitHub Desktop.
This file contains 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
require 'csv' | |
namespace :routes do | |
desc 'Print out defined routes into csv located at tmp/routes.csv' | |
task csv: :environment do |task| | |
CSV.open('tmp/routes.csv', 'wb') do |csv| | |
csv << ['name', 'verb', 'path'] | |
Rails.application.routes.routes.each do |route| | |
csv << [ route.name, route.verb, route.path.spec.to_s ] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment