class Fudge::FileFinder

Allows building of commands which run against a set of files

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/fudge/file_finder.rb, line 6
def initialize(options = {})
  @options = options
end

Public Instance Methods

generate_command(name, tty_options) click to toggle source

Generates a command line with command and any tty_option

# File lib/fudge/file_finder.rb, line 11
def generate_command(name, tty_options)
  cmd = []
  cmd << name
  cmd += tty_options
  cmd << "`#{find_filters.join(' | ')}`"
  cmd.join(' ')
end

Private Instance Methods

exclude_filter() click to toggle source
# File lib/fudge/file_finder.rb, line 29
def exclude_filter
  if (pattern = options[:exclude])
    "grep --color=never -v -E '#{pattern}'"
  end
end
find_filters() click to toggle source
# File lib/fudge/file_finder.rb, line 21
def find_filters
  filters = []
  filters << 'find .'
  filters << "grep --color=never -e '\\.rb$'"
  filters << exclude_filter
  filters.compact
end