Class: GrepFu::FindBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/grep-fu/find_builder.rb

Constant Summary collapse

PRUNE_PATHS =
['/.svn', '/.git', '/vendor', '/log', '/public', '/tmp', '/coverage']

Class Method Summary collapse

Class Method Details

.delicious_prunesObject



5
6
7
# File 'lib/grep-fu/find_builder.rb', line 5

def self.delicious_prunes
  "-path '*#{PRUNE_PATHS.join("' -prune -o -path '*")}' -prune -o"
end

.find_command(options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/grep-fu/find_builder.rb', line 9

def self.find_command(options)
  [
    'find',
    options.file_path,
    delicious_prunes,
    "\\( -size -100000c -type f \\) -print0 | xargs -0 grep",
    options.to_s,
    "\"#{options.search_criteria}\""
  ].join(' ')
end