"Ferramentas de teste de pull requests"

This commit is contained in:
André L F S Bacci
2023-05-23 18:22:45 -03:00
parent a1be1ce087
commit c190ab4f8e
11 changed files with 173 additions and 0 deletions

15
.tools/test/all.sh Executable file
View File

@@ -0,0 +1,15 @@
(cd doc-base; git pull)
(cd en; git pull)
(cd pt_BR; git pull)
php doc-base/configure.php --with-lang=pt_BR --enable-xml-details
rm revcheck.html
php doc-base/scripts/revcheck.php pt_BR > revcheck.html
nohup xdg-open revcheck.html </dev/null >/dev/null 2>&1 &
echo
(cd pt_BR; git status)
echo

9
.tools/test/conf.sh Executable file
View File

@@ -0,0 +1,9 @@
(cd doc-base; git pull)
(cd en; git pull)
(cd pt_BR; git pull)
php doc-base/configure.php --with-lang=pt_BR --enable-xml-details
(cd pt_BR; git status)

4
.tools/test/diff.sh Executable file
View File

@@ -0,0 +1,4 @@
(cd pt_BR; git status)
(cd pt_BR; git diff)

1
.tools/test/find.sh Executable file
View File

@@ -0,0 +1 @@
grep -ri --exclude-dir={doc-base,.svn,.git} --color "$1" .

1
.tools/test/gind.sh Executable file
View File

@@ -0,0 +1 @@
grep -ri --exclude-dir={.svn,.git} --color $1 .

19
.tools/test/open.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
linha=$1
linha=${linha/'phpdoc/'/''}
linha=${linha/'/trunk/'/'/'}
linha=${linha/'./'/''}
linha=${linha/'en/'/''}
linha=${linha/'pt_BR/'/''}
en="en/${linha}";
br="pt_BR/${linha}";
#echo $en;
#echo $br;
nohup gedit $en $br > /dev/null 2>&1 &
#atom $en $br

10
.tools/test/push.sh Executable file
View File

@@ -0,0 +1,10 @@
if [ $# -eq 0 ]
then msg='Update translation.';
else msg=$1;
fi
(cd pt_BR; git commit -a -m "\"$msg\"")
(cd pt_BR; git push)
(cd pt_BR; git status)

65
.tools/test/spce.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
function wsfix( $filename )
{
$strict = false;
$filename = trim( $filename );
if ( strpos( $filename , 'en' ) === 0 )
$filename = substr( $filename , 2 );
if ( strpos( $filename , 'pt_BR' ) === 0 )
$filename = substr( $filename , 5 );
if ( strpos( $filename , '/' ) === 0 )
$filename = substr( $filename , 1 );
$enname = 'en/' . $filename;
$brname = 'pt_BR/' . $filename;
$entext = file_get_contents( $enname );
$brtext = file_get_contents( $brname );
$enlines = explode( "\n" , $entext );
$brlines = explode( "\n" , $brtext );
if ( $strict )
{
if ( count( $enlines ) != count( $brlines ) )
die( "Line strict count differs.\n" );
}
else
{
if ( count( explode( "\n" , rtrim( $entext ) ) ) != count( explode( "\n" , rtrim( $brtext ) ) ) )
die( "Line loose count differs.\n" );
}
$i = 0;
$l = count( $enlines );
for ( $i = 0 ; $i < $l ; $i++ )
{
if ( array_key_exists( $i , $enlines ) == false )
continue;
if ( array_key_exists( $i , $brlines ) == false )
continue;
$en = $enlines[$i];
$br = $brlines[$i];
$ws = "";
$chars = str_split( $en );
foreach( $chars as $char )
if ( $char == ' ' )
$ws .= ' ';
else
break;
$br = $ws . trim( $br );
$br = rtrim( $br );
$brlines[$i] = $br;
}
$brtext = implode( "\n" , $brlines );
file_put_contents( $brname , $brtext );
}
wsfix ( $argv[1] );

27
.tools/test/test.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: $0 [pr number]" >&2
exit 1
fi
rm patch.txt
wget "https://patch-diff.githubusercontent.com/raw/php/doc-pt_br/pull/$1.diff" -O patch.txt
if ! $(cd pt_BR; git apply --check ../patch.txt); then
(cd pt_BR; git apply --verbose ../patch.txt;)
else
(cd pt_BR; git apply ../patch.txt 2>&1 | tee ../merge.txt;)
php doc-base/configure.php --with-lang=pt_BR --enable-xml-details
(cd pt_BR; git status)
(cd pt_BR; git diff)
echo
echo "If OK, accept the pull on GitHub and then "
echo " ./wipe.sh"
echo ""
fi

2
.tools/test/trim.sh Executable file
View File

@@ -0,0 +1,2 @@
(cd pt_BR; git diff --name-only) | xargs -I %f -- dos2unix "pt_BR/%f"
(cd pt_BR; git diff --name-only) | xargs -I %f -- php spce.php "pt_BR/%f"

20
.tools/test/wipe.sh Executable file
View File

@@ -0,0 +1,20 @@
(cd en; git clean -f -d)
(cd en; git checkout .)
(cd en; git reset --hard )
(cd en; git pull --rebase )
(cd en; git rebase --skip )
(cd pt_BR; git clean -f -d)
(cd pt_BR; git checkout .)
(cd pt_BR; git reset --hard )
(cd pt_BR; git pull --rebase )
(cd pt_BR; git rebase --skip )
(cd doc-base; git pull)
(cd en; git pull)
(cd pt_BR; git pull)
(cd en; git status)
(cd pt_BR; git status)