Class: Dorian::Replace
- Inherits:
-
Object
- Object
- Dorian::Replace
- Defined in:
- lib/dorian/replace.rb
Class Method Summary collapse
Class Method Details
.run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dorian/replace.rb', line 3 def self.run if ARGV.size < 3 puts "USAGE: dorian-replace FROM TO FILES..." exit end from = ARGV[0] to = ARGV[1] files = ARGV[2..-1] files.each do |file| next if File.directory?(file) File.write(file, File.read(file).gsub(from, to)) end end |