Created
April 5, 2012 18:06
-
-
Save sharipov-ru/2312899 to your computer and use it in GitHub Desktop.
rake routes with hirb
This file contains hidden or 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
namespace :routes do | |
desc "cool routes" | |
task :cool => :environment do | |
require 'rails/application/route_inspector' | |
module Rails | |
class Application | |
class RouteInspector | |
include Hirb::Console | |
def formatted_routes(routes) | |
table routes.map{ |r| | |
{ | |
:name => r[:name], | |
:verb => r[:verb], | |
:path => r[:path] | |
} | |
}, :fields => [:verb, :name, :path] | |
[] | |
end | |
end | |
end | |
end | |
Rake::Task['routes'].invoke | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment