DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

A Simple Util For Hacking Rails On Windows

06.17.2005
| 5731 views |
  • submit to reddit
        This a simple redish util, that i'm using while hacking my way through rails libs directory. (*nix guys has their natural power tools)
found_files = Dir.glob( ARGV[0] + "/**/*.rb")
serach_pattern = Regexp.new( ARGV[1] )
for entry in found_files
  file = File.new(entry,"r")
  line_count=0
  file.readlines.each { |line|
	line_count+=1
	puts "#{entry}[#{line_count}]:#{line}" if serach_pattern.match(line)
  }
end