summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/package2composer.sh109
-rwxr-xr-xbin/transifexpull.sh38
-rwxr-xr-xbin/updatedb.sh7
3 files changed, 154 insertions, 0 deletions
diff --git a/bin/package2composer.sh b/bin/package2composer.sh
new file mode 100755
index 000000000..c615a177f
--- /dev/null
+++ b/bin/package2composer.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/env php
+<?php
+/*
+ +-----------------------------------------------------------------------+
+ | bin/package2composer.sh |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ | PURPOSE: |
+ | Convert a plugin's package.xml file into a composer.json description |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <thomas@roundcube.net> |
+ +-----------------------------------------------------------------------+
+*/
+
+ini_set('error_reporting', E_ALL & ~E_NOTICE);
+
+list(, $filename, $vendor) = $_SERVER['argv'];
+
+if (!$filename || !is_readable($filename)) {
+ die("Invalid input file name!\nUsage: " . $_SERVER['argv'][0] . " XMLFILE VENDOR\n");
+}
+
+if (!$vendor) {
+ $vendor = 'anonymous';
+}
+
+$package = new SimpleXMLElement(file_get_contents($filename));
+
+$data = array(
+ 'name' => $vendor . '/' . strval($package->name),
+ 'type' => 'roundcube-plugin',
+ 'description' => trim(strval($package->description), '- ') ? trim(strval($package->description)) : trim(strval($package->summary)),
+ 'homepage' => strval($package->uri),
+ 'license' => 'GPLv3+',
+ 'version' => strval($package->version->release),
+ 'authors' => array(),
+ 'repositories' => array(
+ array('type' => 'composer', 'url' => 'http://plugins.roundcube.net'),
+ ),
+ 'require' => array(
+ 'php' => '>=5.3.0',
+ 'roundcube/plugin-installer' => '>=0.1.3',
+ ),
+);
+
+if ($package->license) {
+ $data['license'] = strval($package->license);
+}
+
+if ($package->lead) {
+ foreach ($package->lead as $lead) {
+ if (strval($lead->active) == 'no') {
+ continue;
+ }
+ $data['authors'][] = array(
+ 'name' => strval($lead->name),
+ 'email' => strval($lead->email),
+ 'role' => 'Lead',
+ );
+ }
+}
+
+if ($devs = $package->developer) {
+ foreach ($package->developer as $dev) {
+ $data['authors'][] = array(
+ 'name' => strval($dev->name),
+ 'email' => strval($dev->email),
+ 'role' => 'Developer',
+ );
+ }
+}
+
+if ($package->dependencies->required->extension) {
+ foreach ($package->dependencies->required->extension as $ext) {
+ $data['require']['ext-' . strval($ext->name)] = '*';
+ }
+}
+
+// remove empty values
+$data = array_filter($data);
+
+// use the JSON encoder from the Composer package
+if (is_file('composer.phar')) {
+ include 'phar://composer.phar/src/Composer/Json/JsonFile.php';
+ echo \Composer\Json\JsonFile::encode($data);
+}
+// PHP 5.4's json_encode() does the job, too
+else if (defined('JSON_PRETTY_PRINT')) {
+ $flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT & JSON_UNESCAPED_SLASHES : 0;
+ echo json_encode($data, $flags);
+}
+else {
+ fputs(STDERR,
+"FAILED! composer.phar not found in current directory.
+
+Please download it from http://getcomposer.org/download/ or with
+ curl -s http://getcomposer.org/installer | php
+");
+}
+
+echo "\n";
+
diff --git a/bin/transifexpull.sh b/bin/transifexpull.sh
new file mode 100755
index 000000000..ba26a07f1
--- /dev/null
+++ b/bin/transifexpull.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# In 'translator' mode files will contain empty translated texts
+# where translation is not available, we'll remove these later
+
+# Note: there's a bug in txclib, so if the command below doesn't
+# work see https://github.com/transifex/transifex-client/commit/a80320735973dd608b48520bf3b89ad53e2b088b
+
+tx --debug pull -a --mode translator
+
+PWD=`dirname "$0"`
+
+do_clean()
+{
+ # do not cleanup en_US files
+ echo "$1" | grep -v en_US > /dev/null || return
+
+ echo "Cleaning $1"
+
+ # remove untranslated/empty texts
+ perl -pi -e "s/^\\\$labels\[[^]]+\]\s+=\s+'';\n//" $1
+ perl -pi -e "s/^\\\$messages\[[^]]+\]\s+=\s+'';\n//" $1
+ # remove variable initialization
+ perl -pi -e "s/^\\\$(labels|messages)\s*=\s*array\(\);\n//" $1
+ # remove (one-line) comments
+ perl -pi -e "s/^\\/\\/.*//" $1
+ # remove empty lines (but not in file header)
+ perl -ne 'print if ($. < 18 || length($_) > 1)' $1 > $1.tmp
+ mv $1.tmp $1
+}
+
+# clean up translation files
+for file in $PWD/../program/localization/*/*.inc; do
+ do_clean $file
+done
+for file in $PWD/../plugins/*/localization/*.inc; do
+ do_clean $file
+done
diff --git a/bin/updatedb.sh b/bin/updatedb.sh
index b4ed8b7ba..1f5e18434 100755
--- a/bin/updatedb.sh
+++ b/bin/updatedb.sh
@@ -72,13 +72,20 @@ if (!$version && $opts['version']) {
'0.2-alpha' => 2008040500,
'0.2-beta' => 2008060900,
'0.2-stable' => 2008092100,
+ '0.2.1' => 2008092100,
+ '0.2.2' => 2008092100,
'0.3-stable' => 2008092100,
'0.3.1' => 2009090400,
'0.4-beta' => 2009103100,
+ '0.4' => 2010042300,
+ '0.4.1' => 2010042300,
'0.4.2' => 2010042300,
'0.5-beta' => 2010100600,
'0.5' => 2010100600,
'0.5.1' => 2010100600,
+ '0.5.2' => 2010100600,
+ '0.5.3' => 2010100600,
+ '0.5.4' => 2010100600,
'0.6-beta' => 2011011200,
'0.6' => 2011011200,
'0.7-beta' => 2011092800,