Created
May 4, 2011 19:41
-
-
Save ericsaboia/955866 to your computer and use it in GitHub Desktop.
Puts "utf8 encoding" in all rb files of specified path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (ARGV.size != 1) | |
raise ArgumentError, "you must inform a param with path of ruby files" | |
end | |
files_path = Dir["#{ARGV[0]}**/**{.rb}"] | |
files_path.each do |file_path| | |
data = File.new(file_path).read | |
utf8 = "# encoding: utf-8" | |
File.open(file_path, 'w') { |f| f.write(utf8 + "\n\n" + data) } unless data.include? utf8 | |
end | |
puts "Ruby files inside #{ARGV[0]} suscefull converted to UTF8" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment