mirror of
https://github.com/YunoHost-Apps/webtrees_ynh.git
synced 2024-09-03 18:26:37 +02:00
57 lines
1.7 KiB
PHP
Executable file
57 lines
1.7 KiB
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
/**
|
|
* This file is part of the Rhumsaa\Uuid library
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*
|
|
* @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>
|
|
* @license http://opensource.org/licenses/MIT MIT
|
|
*/
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
if (PHP_SAPI !== 'cli') {
|
|
die('uuid should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL);
|
|
}
|
|
|
|
$files = array(
|
|
__DIR__ . '/../vendor/autoload.php',
|
|
__DIR__ . '/../../../autoload.php',
|
|
);
|
|
|
|
foreach ($files as $file) {
|
|
if (file_exists($file)) {
|
|
require $file;
|
|
define('UUID_COMPOSER_INSTALL', $file);
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!defined('UUID_COMPOSER_INSTALL')) {
|
|
die(
|
|
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
|
|
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
|
'php composer.phar install' . PHP_EOL
|
|
);
|
|
}
|
|
|
|
// We require the Symfony Console component and Moontoast\Math to run
|
|
// this command line tool.
|
|
if (!class_exists('Symfony\Component\Console\Application') || !class_exists('Moontoast\Math\BigNumber')) {
|
|
die(
|
|
'To use the uuid command line tool, you need to install symfony/console' . PHP_EOL .
|
|
'and moontoast/math. To do so, run the following Composer commands:' . PHP_EOL .
|
|
'' . PHP_EOL .
|
|
'composer.phar require "moontoast/math=~1.1" "symfony/console=~2.3"' . PHP_EOL
|
|
);
|
|
}
|
|
|
|
use Rhumsaa\Uuid\Console\Application;
|
|
use Rhumsaa\Uuid\Console\Command;
|
|
|
|
$app = new Application();
|
|
$app->add(new Command\GenerateCommand());
|
|
$app->add(new Command\DecodeCommand());
|
|
$app->run();
|