class ReplaceRecursive

Public Instance Methods

path(name = nil) click to toggle source
# File lib/replace_recursive.rb, line 8
def path(name = nil)
  system "find #{options[:path]} -depth -name '*#{options[:find]}*' -execdir bash -c 'mv \"$1\" \"${1//#{options[:find]}/#{options[:replace]}}\"' _ {} \\;"
end
text(name = nil) click to toggle source
# File lib/replace_recursive.rb, line 16
def text(name = nil)
  system "grep -rl \"#{options[:find]}\" #{options[:path]} | xargs sed -i \"s/#{options[:find]}/#{options[:replace]}/g\""
end