public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Actually add the file referenced in [7730]


git-svn-id: 
http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@7737 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
NZKoz (author)
Wed Oct 03 21:11:51 -0700 2007
commit  a134f8f3c8c2270c8d8e3f9d087184d5959784f9
tree    845794048f2dd244b661c04e3b37f35cf5708220
parent  0a2404f5cc92c30532465713c4979e3417e8090d
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
0
@@ -1 +1,18 @@
0
+desc 'Print out all defined routes in match order, with names.'
0
+task :routes => :environment do
0
+ routes = ActionController::Routing::Routes.routes.collect do |route|
0
+ name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
0
+ verb = route.conditions[:method].to_s.upcase
0
+ segs = route.segments.inject("") { |str,s| str << s.to_s }
0
+ segs.chop! if segs.length > 1
0
+ reqs = route.requirements.empty? ? "" : route.requirements.inspect
0
+ {:name => name, :verb => verb, :segs => segs, :reqs => reqs}
0
+ end
0
+ name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max
0
+ verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max
0
+ segs_width = routes.collect {|r| r[:segs]}.collect {|s| s.length}.max
0
+ routes.each do |r|
0
+ puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:segs].ljust(segs_width)} #{r[:reqs]}"
0
+ end
0
+end

Comments

    No one has commented yet.