I am always forced to make my terminal window two dual monitors wide just to see read them right. I\'m not a stickler for buttery GUI\'s, but this is ridiculous.
Is ther
I've rewritten the rake routes command slightly to generate a slightly more usable html version of the rake routes output
Create a file pretty_routes.rake
and put this in lib/tasks/
and call rake pretty_routes
and it should be slightly better
desc 'Pretty print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
task :pretty_routes => :environment do
all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes
routes = all_routes.collect do |route|
name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
verb = route.conditions[:method].to_s.upcase
segs = route.segments.inject("") { |str,s| str << s.to_s }
segs.chop! if segs.length > 1
reqs = route.requirements.empty? ? "" : route.requirements.inspect
{:name => name, :verb => verb, :segs => segs, :reqs => reqs}
end
File.open(File.join(RAILS_ROOT, "routes.html"), "w") do |f|
f.puts "Rails Routes "
f.puts "Name Verb Segments Requirements "
routes.each do |r|
f.puts "#{r[:name]} #{r[:verb]} #{r[:segs]} #{r[:reqs]} "
end
f.puts "
"
end
`open #{File.join(RAILS_ROOT, "routes.html")}`
end
The second to last line only works on Mac OSX an in rails 2.x, but it automatically opens the file in your browser. If you are on a different platform, you will have to change the command.
If you are running Rails 3.x, the second to last line should be
`open #{File.join(Rails.root, "routes.html")}`