Ticket #53: cov.sh

File cov.sh, 462 bytes (added by amuller, 17 years ago)

Adiciona um contador em todas as funções do php

Line 
1#!/bin/bash
2for i in $(ls *.php);
3do
4        sed -r 's@\tfunction\ (.{0,})@function\ \1\n\{\n\t$_SESSION[\"debug\"][\"\1\"]++\;@g' $i > temp
5        mv temp $i;
6        sed -r  's@\$_SESSION\[\"debug\"\]\[\"([a-Z_]{0,})\(.{0,}\)\"\]@$_SESSION[\"debug\"][\"\1\"]@g' $i > temp
7        mv temp $i;
8        h=0;
9        for j in $(grep -n '_SESSION\[\"debug\"\]' $i | cut -d':' -f1)
10        do
11                j=$(($j-h));
12                cat $i | head -n$j > temp
13                cat $i | tail -n+$(($j+2)) >> temp
14                mv temp $i;
15                h=$(($h+1));
16        done
17done;