4 # find . -type f | grep -v log/ | grep -v lib/ | xargs grep -in KEYWORD
6 SCRIPT_DIR
= File
.dirname(File
.expand_path(__FILE__
))
7 SCRIPT_NAME
= $0.split('/')[-1]
11 `find -type f`.each
do |file_name
|
16 when /\.$/, /\.git/, /~$/
19 when /^\.\/lib\
/dict\/words
/, /^\
.\
/log\
//
22 when /^\.\/vendor\
//, /^\.\/doc\
//
23 # Even ignore the Vendors and Documentation files!
28 next if `file -i -b #{file_name}` =~
/^image/
31 File
.open(file_name
).each_with_index
do |line_text
, line_number
|
32 if line_text
.downcase
=~
/#{ARGV[0].downcase}/
33 puts file_name
.rjust(75, '=') + '=' * 5 unless found
35 print
"#{line_number.to_s.rjust(5)}: "
36 if line_text
.size
< 72
39 puts line_text
[0..69] + '...'