Skip to content

Instantly share code, notes, and snippets.

@nbarthelemy
Created August 29, 2018 15:59
Show Gist options
  • Save nbarthelemy/18b3d000a6d834df3884eb7d5cf1cd0a to your computer and use it in GitHub Desktop.
Save nbarthelemy/18b3d000a6d834df3884eb7d5cf1cd0a to your computer and use it in GitHub Desktop.
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