Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2013-07-22 00:09:08 +0400
committersgiehl <stefan@piwik.org>2013-07-22 00:09:08 +0400
commitf49ea29282502b3efee32dffce14276f65599ec3 (patch)
tree44dafc83c669650b74726e3bdc19eee6a3afe040 /misc
parent90411ce70157f60577fd0c13a7a19158e7cfdd8f (diff)
added no-git mode to translation update
Diffstat (limited to 'misc')
-rw-r--r--misc/updateLanguageFiles.sh133
1 files changed, 77 insertions, 56 deletions
diff --git a/misc/updateLanguageFiles.sh b/misc/updateLanguageFiles.sh
index 2ad201446e..1715bef6c8 100644
--- a/misc/updateLanguageFiles.sh
+++ b/misc/updateLanguageFiles.sh
@@ -1,6 +1,12 @@
#!/bin/bash
PIWIKPATH=$PWD/..
+ENABLEGIT=1;
+if [ $1 == '--no-git' ]; then
+ ENABLEGIT=0;
+ echo "NO-GIT MODE: No git actions will be performed!!"
+fi
+
################################
# Configuration
#
@@ -13,20 +19,24 @@ OTranceUser="downloaduser"
# Perform initial git actions
#
# update master branch
-git checkout master > /dev/null 2>&1
-git pull > /dev/null 2>&1
+if [ $ENABLEGIT -eq 1 ]; then
-# check if branch exists local (assume its the correct one if so)
-git branch | grep $GitBranchName > /dev/null 2>&1
+ git checkout master > /dev/null 2>&1
+ git pull > /dev/null 2>&1
-if [ $? -eq 1 ]; then
- git checkout -b $GitBranchName origin/$GitBranchName > /dev/null 2>&1
-fi
+ # check if branch exists local (assume its the correct one if so)
+ git branch | grep $GitBranchName > /dev/null 2>&1
+
+ if [ $? -eq 1 ]; then
+ git checkout -b $GitBranchName origin/$GitBranchName > /dev/null 2>&1
+ fi
+
+ # switch to branch and merge with master
+ git checkout $GitBranchName > /dev/null 2>&1
+ git merge master > /dev/null 2>&1
+ git push origin $GitBranchName > /dev/null 2>&1
-# switch to branch and merge with master
-git checkout $GitBranchName > /dev/null 2>&1
-git merge master > /dev/null 2>&1
-git push origin $GitBranchName > /dev/null 2>&1
+fi
#
################################
@@ -114,16 +124,22 @@ mv *.php ../lang/
cd $PIWIKPATH
list=(`git ls-files --other --exclude-standard lang`)
-echo "Untracked language files detected:
- Please choose the files that should be added to git.
- Other files will be removed.";
+if [ $ENABLEGIT -eq 1 ]; then
+ echo "Untracked language files detected:
+ Please choose the files that should be added to git.
+ Other files will be removed.";
+else
+ echo "Untracked language files detected:
+ Please choose the files that should be kept.
+ Other files will be removed.";
+fi;
for file in ${list[@]}
do
while true; do
read -p "Add new file $file to git? " yn
case $yn in
- [Yy]* ) git add $file; break;;
+ [Yy]* ) if [ $ENABLEGIT -eq 1 ]; then git add $file; fi; break;;
[Nn]* ) rm $file; break;;
* ) echo "Please answer yes or no. ";;
esac
@@ -136,6 +152,7 @@ done
# Cleanup / Test new files
#
# run tests to cleanup files as long as tests are failing
+echo "" &> $PIWIKPATH/tmp/languagecleanup.txt
counter=0
while true; do
@@ -148,7 +165,7 @@ while true; do
# run tests to cleanup files
echo "Running unittests to cleanup language files. This may take some time..."
cd $PIWIKPATH/tests/PHPUnit
- phpunit --group LanguagesManager > /dev/null 2>&1
+ phpunit --group LanguagesManager >> $PIWIKPATH/tmp/languagecleanup.txt
# If all tests pass, break loop
if [ $? -eq 0 ]; then
@@ -172,50 +189,54 @@ done
# Perform finish git actions & create pull request
#
# commit files
-cd $PIWIKPATH
-git add lang/. > /dev/null 2>&1
-git commit -m "language update refs #3430"
-git push
+if [ $ENABLEGIT -eq 1 ]; then
-while true; do
- read -p "Please provide your github username (to create a pull request using Github API): " username
-
- returnCode=(`curl \
- -X POST \
- -k \
- --silent \
- --write-out %{http_code} \
- --stderr /dev/null \
- -o /dev/null \
- -u $username \
- --data "{\"title\":\"automatic translation update\",\"body\":\"autogenerated translation update out of $downloadfile\",\"head\":\"$GitBranchName\",\"base\":\"master\"}" \
- -H 'Accept: application/json' \
- https://api.github.com/repos/piwik/piwik/pulls`);
-
- if [ $returnCode -eq 401 ]; then
- echo "Pull request failed. Bad credentials... Please try again"
- continue;
- fi
+ cd $PIWIKPATH
+ git add lang/. > /dev/null 2>&1
+ git commit -m "language update refs #3430"
+ git push
- if [ $returnCode -eq 422 ]; then
- echo "Pull request failed. Unprocessable Entity. Maybe a pull request was already created before."
- break;
- fi
-
- if [ $returnCode -eq 201 ]; then
- echo "Pull request successfully created."
- break;
- fi
-
- if [ $returnCode -eq 200 ]; then
- echo "Pull request successfully created."
- break;
- fi
+ while true; do
+ read -p "Please provide your github username (to create a pull request using Github API): " username
+
+ returnCode=(`curl \
+ -X POST \
+ -k \
+ --silent \
+ --write-out %{http_code} \
+ --stderr /dev/null \
+ -o /dev/null \
+ -u $username \
+ --data "{\"title\":\"automatic translation update\",\"body\":\"autogenerated translation update out of $downloadfile\",\"head\":\"$GitBranchName\",\"base\":\"master\"}" \
+ -H 'Accept: application/json' \
+ https://api.github.com/repos/piwik/piwik/pulls`);
+
+ if [ $returnCode -eq 401 ]; then
+ echo "Pull request failed. Bad credentials... Please try again"
+ continue;
+ fi
+
+ if [ $returnCode -eq 422 ]; then
+ echo "Pull request failed. Unprocessable Entity. Maybe a pull request was already created before."
+ break;
+ fi
+
+ if [ $returnCode -eq 201 ]; then
+ echo "Pull request successfully created."
+ break;
+ fi
+
+ if [ $returnCode -eq 200 ]; then
+ echo "Pull request successfully created."
+ break;
+ fi
+
+ echo "Pull request failed."
- echo "Pull request failed."
+ done
-done;
+ git checkout master > /dev/null 2>&1
-git checkout master > /dev/null 2>&1
+fi
#
################################ \ No newline at end of file