From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../Component/Intl/Resources/bin/common.php | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php new file mode 100644 index 00000000..4fadbe82 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +define('LINE_WIDTH', 75); + +define('LINE', str_repeat('-', LINE_WIDTH) . "\n"); + +function bailout($message) +{ + echo wordwrap($message, LINE_WIDTH) . " Aborting.\n"; + + exit(1); +} + +function strip_minor_versions($version) +{ + preg_match('/^(?P[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches); + + return $matches['version']; +} + +function centered($text) +{ + $padding = (int) ((LINE_WIDTH - strlen($text))/2); + + return str_repeat(' ', $padding) . $text; +} + +function cd($dir) +{ + if (false === chdir($dir)) { + bailout("Could not switch to directory $dir."); + } +} + +function run($command) +{ + exec($command, $output, $status); + + if (0 !== $status) { + $output = implode("\n", $output); + echo "Error while running:\n " . getcwd() . '$ ' . $command . "\nOutput:\n" . LINE . "$output\n" . LINE; + + bailout("\"$command\" failed."); + } +} + +function get_icu_version_from_genrb($genrb) +{ + exec($genrb . ' --version 2>&1', $output, $status); + + if (0 !== $status) { + bailout($genrb . ' failed.'); + } + + if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) { + return null; + } + + return $matches[1]; +} -- cgit v1.2.3