Skip to content

Instantly share code, notes, and snippets.

@bquorning
Forked from jacobat/gist:150879
Created July 20, 2009 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bquorning/150903 to your computer and use it in GitHub Desktop.
Save bquorning/150903 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
grep_result = `grep -ri "def " #{ARGV.join(' ')}`
methods = grep_result.split("\n").collect do |line|
line[/.*:\s+def ([a-z_]+)(\((.*)\))?/i, 1]
end
filtered_methods = methods.uniq - ["initialize"]
dirs = (Dir.glob("*") - ['vendor', 'log']).join(" ")
filtered_methods.each do |method_name|
cmd = "grep -ri #{method_name} #{dirs}"
lines = `#{cmd}`
puts "#{method_name} only found once" if lines.split("\n").size < 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment