Le 31/07/2011 12:27, Ganath Rathnayake a écrit :
Hi all,
I wrote a script to change the old folder structure to the new in which test
and code separated. In my previous mail I proposed the logic which I am
going to implement it. Since some issues and less number of codes I changed
the logic a bit. All the code looks as follows.

for i in applications specialpurpose framework
do
     #echo $i
cd $i

for dir in $(ls .)
do
     #echo $dir

     if [ $dir != .. ]
     then
         if [ -d $dir ]
         then
             cd $dir
             #echo $dir

             if [ -d src/ ]
             then
                 echo $dir
                 cd src/
                 SRC=$(pwd)

                 mkdir -p main/java/ test/java/
                 cp -r org/ main/java/

                 cd main/java/
                 testdirs=$(find ./ | grep /test$)
                 cd ../../

                 for test in $testdirs
                 do
                     cd test/java/
                     test=$(echo $test | replace test '')
                     mkdir -p $test
                     cd ../../
                     cp main/java/$test/test/*  test/java/$test
                     rm -r main/java/$test/test/
                 done

                 git add main/ test/
                 git rm -r org/

                 cd ..
             fi

             cd ..
         fi
     fi

done
cd ..
done

Though this makes the folder structure it does not change the some file
content which needs to correct to build Ofbiz successfully and run the test
successfully.
Since it is bit hard to do recursively I need address all the issues
manually and separately for correct each. So before I did it I thought of
having a file which include the changes needed to build and run tests
successfully. I will update it as soon as possible.

Ganath,

you can use sed to make some modifications in the files.

Cheers,

--
Erwan de FERRIERES
www.nereide.biz

Reply via email to