Skip to content

Instantly share code, notes, and snippets.

@slowjud
Created August 12, 2009 05:05
Show Gist options
  • Save slowjud/166336 to your computer and use it in GitHub Desktop.
Save slowjud/166336 to your computer and use it in GitHub Desktop.
foo = {}
basenames = ActionController::Routing::Routes.named_routes.routes.keys
basenames.each {|name| foo[name] = false}
Dir.glob(File.join(RAILS_ROOT, '/app', '**', '*.rb')).each do |file|
data = File.read(file)
basenames.each do |basename|
reg = Regexp.new(basename.to_s+"_(?=url|path)")
if reg.match data
foo[basename] = true
end
end
end
unused = foo.reject{|k, v| v == true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment