Skip to content

Instantly share code, notes, and snippets.

@aisuii
Created June 15, 2011 05:27
Show Gist options
  • Save aisuii/1026535 to your computer and use it in GitHub Desktop.
Save aisuii/1026535 to your computer and use it in GitHub Desktop.
#! /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