]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/copy-stubs-to-component.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / symfony / intl / Symfony / Component / Intl / Resources / bin / copy-stubs-to-component.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 use Symfony\Component\Filesystem\Filesystem;
13 use Symfony\Component\Icu\IcuData;
14 use Symfony\Component\Intl\Intl;
15
16 require_once __DIR__ . '/common.php';
17 require_once __DIR__ . '/autoload.php';
18
19 if (1 !== $GLOBALS['argc']) {
20 bailout(<<<MESSAGE
21 Usage: php copy-stubs-to-component.php
22
23 Copies stub files created with create-stubs.php to the Icu component.
24
25 For running this script, the intl extension must be loaded and all vendors
26 must have been installed through composer:
27
28 composer install --dev
29
30 MESSAGE
31 );
32 }
33
34 echo LINE;
35 echo centered("ICU Resource Bundle Stub Update") . "\n";
36 echo LINE;
37
38 if (!class_exists('\Symfony\Component\Icu\IcuData')) {
39 bailout('You must run "composer update --dev" before running this script.');
40 }
41
42 $stubBranch = '1.0.x';
43
44 if (!IcuData::isStubbed()) {
45 bailout("Please switch to the Icu component branch $stubBranch.");
46 }
47
48 $filesystem = new Filesystem();
49
50 $sourceDir = sys_get_temp_dir() . '/icu-stubs';
51 $targetDir = IcuData::getResourceDirectory();
52
53 if (!$filesystem->exists($sourceDir)) {
54 bailout("The directory $sourceDir does not exist. Please run create-stubs.php first.");
55 }
56
57 $filesystem->remove($targetDir);
58
59 echo "Copying files from $sourceDir to $targetDir...\n";
60
61 $filesystem->mirror($sourceDir, $targetDir);
62
63 echo "Done.\n";