Class: ExtensionFixer

Inherits:
Object
  • Object
show all
Defined in:
lib/extension_fixer.rb

Overview

A ruby gem to fix file extensions

Instance Method Summary collapse

Instance Method Details

#checkObject



7
8
9
10
11
12
# File 'lib/extension_fixer.rb', line 7

def check
  # Check all files for the correct extension type
  walk_args do |file, right_ext|
    p "#{file} should have a #{right_ext} extension."
  end
end

#fixObject



14
15
16
17
18
19
20
# File 'lib/extension_fixer.rb', line 14

def fix
  # Change all files to the correct extension types
  walk_args do |file, right_extension|
    p "$ mv #{file.gsub(File.extname(file), '{\0,.' + right_extension + '}')}"
    File.rename file, file.ext(right_extension)
  end
end