Created
March 27, 2012 11:47
-
-
Save brainopia/2215241 to your computer and use it in GitHub Desktop.
Set bom recursively to ruby files
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
#!/usr/bin/env ruby | |
require 'epath' | |
bom = "\xEF\xBB\xBF".force_encoding('binary') | |
Path.glob('**/*.rb') do |file| | |
next if file.binread(3) == bom | |
previous = file.binread | |
file.write bom + previous | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment