4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 use Symfony\Component\Filesystem\Filesystem
;
13 use Symfony\Component\Icu\IcuData
;
14 use Symfony\Component\Intl\Intl
;
16 require_once __DIR__
. '/common.php';
17 require_once __DIR__
. '/autoload.php';
19 if (1 !== $GLOBALS['argc']) {
21 Usage: php copy-stubs-to-component.php
23 Copies stub files created with create-stubs.php to the Icu component.
25 For running this script, the intl extension must be loaded and all vendors
26 must have been installed through composer:
28 composer install --dev
35 echo centered("ICU Resource Bundle Stub Update") . "\n";
38 if (!class_exists('\Symfony\Component\Icu\IcuData')) {
39 bailout('You must run "composer update --dev" before running this script.');
42 $stubBranch = '1.0.x';
44 if (!IcuData
::isStubbed()) {
45 bailout("Please switch to the Icu component branch $stubBranch.");
48 $filesystem = new Filesystem();
50 $sourceDir = sys_get_temp_dir() . '/icu-stubs';
51 $targetDir = IcuData
::getResourceDirectory();
53 if (!$filesystem->exists($sourceDir)) {
54 bailout("The directory $sourceDir does not exist. Please run create-stubs.php first.");
57 $filesystem->remove($targetDir);
59 echo "Copying files from $sourceDir to $targetDir...\n";
61 $filesystem->mirror($sourceDir, $targetDir);