Skip to content
Extraits de code Groupes Projets
Valider d8c49717 rédigé par Dorian's avatar Dorian Validation de Stephen Caudill
Parcourir les fichiers

Improve whitespace:cleanup and whitespace:retab

parent 6ffc03a4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
namespace :whitespace do namespace :whitespace do
desc 'Removes trailing whitespace' desc 'Removes trailing whitespace'
task :cleanup do task :cleanup do
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;} sh %{for f in `find . -type f | grep -v -e '.git/' -e 'public/' -e '.png'`;
do cat $f | sed 's/[ \t]*$//' > tmp; cp tmp $f; rm tmp; echo -n .;
done}
end end
desc 'Converts hard-tabs into two-space soft-tabs' desc 'Converts hard-tabs into two-space soft-tabs'
task :retab do task :retab do
sh %{find . -name '*.rb' -exec sed -i '' 's/\t/ /g' {} \\;} sh %{for f in `find . -type f | grep -v -e '.git/' -e 'public/' -e '.png'`;
do cat $f | sed 's/\t/ /g' > tmp; cp tmp $f; rm tmp; echo -n .;
done}
end end
desc 'Remove consecutive blank lines' desc 'Remove consecutive blank lines'
task :scrub_gratuitous_newlines do task :scrub_gratuitous_newlines do
sh %{find . -name '*.rb' -exec sed -i '' '/./,/^$/!d' {} \\;} sh %{find . -name '*.rb' -exec sed -i '' '/./,/^$/!d' {} \\;}
end end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter