From ee0fca9252320d8f870ca247e7cf079577a2b01b Mon Sep 17 00:00:00 2001
From: Lahmizzar Muinela <lahmizzar@devxive.com>
Date: Fri, 03 Jan 2014 19:01:48 -0500
Subject: [PATCH] add language package build script

---
 builder/buildManifest |  110 ++++++++++++++++++
 builder/create        |   89 ++++++++++++++
 build                 |   56 +++++++++
 builder/pull          |  101 ++++++++++++++++
 4 files changed, 356 insertions(+), 0 deletions(-)

diff --git a/build b/build
new file mode 100755
index 0000000..5ad452f
--- /dev/null
+++ b/build
@@ -0,0 +1,56 @@
+#!/bin/bash
+clear
+  ######################################
+  # Author: devXive, Lahmizzar Muinela #
+  # Email: support@devxive.com         #
+  # Twitter: @devXive                  #
+  # Website: http://www.devxive.com    #
+  ######################################
+
+# Simple script to build an appropriate language manifest
+#
+# How to use
+# ./build update 4.2.0b4 2013-12-06 (Fetch Updates from transifex and create the install file)
+# ./build 4.2.0b4 2013-12-06 (Create the install file from current languages folder)
+
+# Name as used in builder/create
+tempDir="pkg_projectfork_languages"
+version="$2"
+
+if [[ "$1" == "--help" || "$2" == "--help" || "$3" == "--help" || "$4" == "--help" ]]
+    then
+      echo 'How to use:'
+      echo '-----------'
+      echo 'Fetch updates from transifex first, then build the language installer package'
+      echo '  ./build update [version_number_to_set] [manual_build_date]'
+      echo '  EG: ./build update 4.2.0b4 2013-12-06'
+      echo ' '
+      echo 'Create the language installer package from current state (without updating languages from transifex first)'
+      echo '  ./build [version_number_to_set] [manual_build_date]'
+      echo '  EG: ./build noupdate 4.2.0b4 2013-12-06'
+      echo ' '
+      echo 'If you want tu use the current timestamp as build date'
+      echo '  ./build noupdate 4.2.0.4b'
+      echo 'or'
+      echo '  ./build update 4.2.0.4b'
+      echo ' '
+      echo ' '
+      echo 'This Help'
+      echo '  ./build --help'
+      echo ' '
+      echo ' '
+      echo 'To get advanced instructions on how to use the transifex client, you have to read the API. http://api.transifex.com.'
+    exit 1 
+  fi
+
+if [[ "$1" == "" || "$2" == "" ]]
+    then
+      echo 'Error: Not all options set! Type "./build --help" to get more options'
+    exit 1 
+  fi
+
+builder/create $1 $2 $3
+
+# Create zip here to prevent deep folder creations in zip file // TODO: Fix this!
+zip -r archive/zips/lang_pf4_$version.zip $tempDir/*
+rm -rf "$tempDir"
\ No newline at end of file
diff --git a/builder/buildManifest b/builder/buildManifest
new file mode 100755
index 0000000..e35da4d
--- /dev/null
+++ b/builder/buildManifest
@@ -0,0 +1,110 @@
+#!/bin/bash
+
+  ######################################
+  # Author: devXive, Lahmizzar Muinela #
+  # Email: support@devxive.com         #
+  # Twitter: @devXive                  #
+  # Website: http://www.devxive.com    #
+  ######################################
+
+# Simple script to build an appropriate language manifest
+#
+# How to use
+# ./buildManifest [Joomla Language String] [Transifex Language String]
+#
+# > ./buildManifest ru-RU
+
+rootPath='../languages'
+
+# Settings
+filePrefix='lang_pf4_'
+
+# ver='4.2.0b4'
+ver="$3"
+creationDate=''
+name="Projectfork Language - $1"
+author='Projectfork Translation Team'
+authorEmail='support@projectfork.net'
+authorUrl='www.projectfork.net'
+copyright='(C) 2012 - 2013 by the Projectfork Translation Team. All rights reserved.'
+
+# Advanced Settings
+installVer="2.5"
+
+########## ------------------- DO NOT TOUCH BELOW ------------------- ##########
+# Set language string
+lang="$1"
+txLang="$2"
+
+# Prepare file and directory
+file="$filePrefix$lang$fileSuffix.xml"
+dir="$lang"
+
+rm -rf "$rootPath/$dir/$file"
+# rm -rf "$rootPath/$dir"
+
+mkdir "$rootPath/$dir"
+touch "$rootPath/$dir/$file"
+
+newFile="$rootPath/$dir/$file"
+
+if [[ "$creationDate" == "" ]]
+    then
+		creationDate=$(date +"%Y-%m-%d")
+	fi
+
+echo '<?xml version="1.0" encoding="utf-8"?>' >> "$newFile"
+echo '<extension type="file" version="'"$installVer"'" method="upgrade">' >> "$newFile"
+echo "	<name>$name</name>" >> "$newFile"
+echo "	<author>$author</author>" >> "$newFile"
+echo "	<creationDate>$creationDate</creationDate>" >> "$newFile"
+echo "	<copyright>$copyright</copyright>" >> "$newFile"
+echo "	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>" >> "$newFile"
+echo "	<authorEmail>$authorEmail</authorEmail>" >> "$newFile"
+echo "	<authorUrl>$authorUrl</authorUrl>" >> "$newFile"
+echo "	<version>$ver</version>" >> "$newFile"
+echo "	<description>" >> "$newFile"
+echo "		<![CDATA[" >> "$newFile"
+echo "			The $lang language pack for Projectfork 4, a Project Management extension for Joomla!" >> "$newFile"
+echo "" >> "$newFile"
+echo "			<h6>Translation Credits:</h6>" >> "$newFile"
+echo "			<strong>This translation is brought to you by the <a href=\"https://www.transifex.com/projects/p/projectfork-languages/language/$txLang/members/\" target=\"_blank\">$lang - Translation Team</a></strong>" >> "$newFile"
+echo "		]]>" >> "$newFile"
+echo "	</description>" >> "$newFile"
+echo "" >> "$newFile"
+echo "	<fileset>" >> "$newFile"
+echo "		<files folder=\"admin\" target=\"administrator/language/$lang\">" >> "$newFile"
+echo "			<filename>$lang.com_pfcomments.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfcomments.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfforum.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfforum.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfmilestones.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfmilestones.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfprojects.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfprojects.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfrepo.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfrepo.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pftasks.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pftasks.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pftime.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pftime.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfusers.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_pfusers.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_projectfork.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.com_projectfork.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.plg_content_pfcomments.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.plg_content_pfcomments.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.plg_content_pfnotifications.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.plg_content_pfnotifications.sys.ini</filename>" >> "$newFile"
+echo "		</files>" >> "$newFile"
+echo "" >> "$newFile"
+echo "		<files folder=\"site\" target=\"language/$lang\">" >> "$newFile"
+echo "			<filename>$lang.com_projectfork.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.mod_pf_dash_buttons.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.mod_pf_dash_buttons.sys.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.mod_pf_tasks.ini</filename>" >> "$newFile"
+echo "			<filename>$lang.mod_pf_tasks.sys.ini</filename>" >> "$newFile"
+echo "		</files>" >> "$newFile"
+echo "	</fileset>" >> "$newFile"
+echo "</extension>" >> "$newFile"
+
diff --git a/builder/create b/builder/create
new file mode 100755
index 0000000..255ae17
--- /dev/null
+++ b/builder/create
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+  ######################################
+  # Author: devXive, Lahmizzar Muinela #
+  # Email: support@devxive.com         #
+  # Twitter: @devXive                  #
+  # Website: http://www.devxive.com    #
+  ######################################
+
+# Simple script to build an appropriate language manifest
+#
+# How to use
+# ./create update 4.2.0b4 2013-12-06 (Fetch Updates from transifex first, then create the install file)
+# ./create 4.2.0b4 2013-12-06 (Create the install file from the existing/current languages folder)
+
+setUpdate="$1"
+setVersion="$2"
+setDate="$3"
+
+if [[ "$1" != "update" && "$1" != "noupdate" ]]
+    then
+      echo 'Please use update or noupdate or add option --help to get more informations'
+    exit 1 
+  fi
+
+if [[ "$1" != "" && "$2" == "" ]]
+    then
+    	echo 'Please set a version number or add option --help to get more informations'
+		exit 1 
+	fi
+
+if [[ "$3" == "" ]]
+    then
+		setDate=$(date +"%Y-%m-%d")
+    echo 'Using $setDate as build date'
+	fi
+
+version=$setVersion
+creationDate=$setDate
+
+if [[ "$1" == "update" ]]
+    then
+    ./pull $version
+  fi
+
+sourcePath=$(realpath .)
+
+tempDir="$sourcePath/pkg_projectfork_languages"
+fileName="pkg_projectfork_languages.xml"
+
+rm -rf "$tempDir"
+mkdir "$tempDir"
+
+touch "$tempDir/$fileName"
+
+cp -r $sourcePath/languages $tempDir
+cp -r $sourcePath/archive/installer $tempDir
+cp $sourcePath/archive/install.script.php $tempDir
+
+file="$tempDir/pkg_projectfork_languages.xml"
+
+echo '<?xml version="1.0" encoding="UTF-8"?>' >> "$file"
+echo '<extension type="package" version="2.5" method="upgrade">' >> "$file"
+echo '	<name>Projectfork Language Pack Installer</name>' >> "$file"
+echo '	<packagename>projectfork_languages</packagename>' >> "$file"
+echo "	<creationDate>$creationDate</creationDate>" >> "$file"
+echo '	<author>Projectfork Translation Team</author>' >> "$file"
+echo '	<authorEmail>support@projectfork.net</authorEmail>' >> "$file"
+echo '	<authorUrl>http://www.projectfork.net</authorUrl>' >> "$file"
+echo '	<copyright>(C) 2012 - 2013 by the Projectfork Translation Team. All rights reserved.</copyright>' >> "$file"
+echo "	<version>$version</version>" >> "$file"
+echo '	<updateable>fullupdate</updateable>' >> "$file"
+echo '	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>' >> "$file"
+echo '	<description></description>' >> "$file"
+echo '' >> "$file"
+echo '	<scriptfile>install.script.php</scriptfile>' >> "$file"
+echo '' >> "$file"
+echo '	<files folder="languages">' >> "$file"
+echo '	</files>' >> "$file"
+echo '' >> "$file"
+echo '	<!-- Extension Update Specification -->' >> "$file"
+echo '	<updateservers>' >> "$file"
+echo '		<server type="extension" priority="1" name="PF4 Translation Update Server">https://raw.github.com/projectfork/Translations/master/archive/update.xml</server>' >> "$file"
+echo '	</updateservers>' >> "$file"
+echo '</extension>' >> "$file"
+
+# zip build in build script
+# zip -r $sourcePath/archive/zips/lang_pf4_$version.zip $tempDir/*
+# rm -rf "$tempDir"
\ No newline at end of file
diff --git a/builder/pull b/builder/pull
new file mode 100755
index 0000000..dc85302
--- /dev/null
+++ b/builder/pull
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+  ######################################
+  # Author: devXive, Lahmizzar Muinela #
+  # Email: support@devxive.com         #
+  # Twitter: @devXive                  #
+  # Website: http://www.devxive.com    #
+  ######################################
+
+# Simple script to pull tx translatons and build manifest files
+# To add a language, please have a look at the .tx/config file, if the language exists
+#
+# How to use
+# > ./pull
+
+txClient="../../../transifex-client/tx"
+version="$1"
+
+$txClient pull -l fr_FR	# 100%
+./buildManifest fr-FR fr_FR $version
+
+$txClient pull -l de_DE	# 100%
+./buildManifest de-DE de_DE $version
+
+$txClient pull -l hu_HU	# 100%
+./buildManifest hu-HU hu_HU $version
+
+$txClient pull -l pt_BR	# 100%
+./buildManifest pt-BR pt_BR $version
+
+$txClient pull -l es_ES	# 100%
+./buildManifest es-ES es_ES $version
+
+$txClient pull -l tr_TR	# 100%
+./buildManifest tr-TR tr_TR $version
+
+$txClient pull -l pl_PL	# 98%
+./buildManifest pl-PL pl_PL $version
+
+$txClient pull -l ca_ES	# 97%
+./buildManifest ca-ES ca_ES $version
+
+$txClient pull -l zh_TW	# 97%
+./buildManifest zh-TW zh_TW $version
+
+$txClient pull -l nl_NL	# 97%
+./buildManifest nl-NL nl_NL $version
+
+$txClient pull -l it_IT	# 97%
+./buildManifest it-IT it_IT $version
+
+$txClient pull -l ja_JP	# 97%
+./buildManifest ja-JP ja_JP $version
+
+$txClient pull -l ro_RO	# 97%
+./buildManifest ro-RO ro_RO $version
+
+$txClient pull -l th_TH	# 97%
+./buildManifest th-TH th_TH $version
+
+$txClient pull -l ru_RU	# 95%
+./buildManifest ru-RU ru_RU $version
+
+$txClient pull -l el_GR	# 94%
+./buildManifest el-GR el_GR $version
+
+$txClient pull -l cs_CZ	# 93%
+./buildManifest cs-CZ cs_CZ $version
+
+$txClient pull -l pt_PT	# 93%
+./buildManifest pt-PT pt_PT $version
+
+$txClient pull -l da_DK	# 92%
+./buildManifest da-DK da_DK $version
+
+$txClient pull -l sv_SE	# 90%
+./buildManifest sv-SE sv_SE $version
+
+$txClient pull -l nb_NO	# 84%
+./buildManifest nb-NO nb_NO $version
+
+$txClient pull -l sk_SK	# 69%
+./buildManifest sk-SK sk_SK $version
+
+$txClient pull -l uk_UA	# 56%
+./buildManifest uk-UA uk_UA $version
+
+$txClient pull -l nl_BE	# 41%
+./buildManifest nl-BE nl_BE $version
+
+$txClient pull -l bg_BG	# 34%
+./buildManifest bg-BG bg_BG $version
+
+$txClient pull -l es_MX	# 31%
+./buildManifest es-MX es_MX $version
+
+$txClient pull -l ar_AA	# 23%
+./buildManifest ar-AA ar_AA $version
+
+$txClient pull -l fa_IR	# 14%
+./buildManifest fa-IR fa_IR $version
\ No newline at end of file

--
Gitblit v1.9.1