Created
June 15, 2011 05:27
-
-
Save aisuii/1026535 to your computer and use it in GitHub Desktop.
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
#! /bin/sh | |
OSTYPE=`uname` | |
SED="sed" | |
if [ "${OSTYPE}x" != 'Linuxx' ] | |
then | |
SED="gsed" | |
fi | |
for i in `find app config db lib test spec -type f \( -name '*.rb' -o -name '*.rjs' -o -name '*.erb' -o -name '*.sel' \)` | |
do | |
head -1 $i | grep -y utf > /dev/null 2>&1 | |
if [ $? -ne 0 ] | |
then | |
echo $i | |
case $i in | |
*.erb) | |
$SED -i "1s/^/\<\%\# -*- coding:utf-8 -*- -\%\>\n/" $i | |
;; | |
*) | |
$SED -i "1s/^/# -*- coding:utf-8 -*-\n/" $i | |
;; | |
esac | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment