* initial commit

This commit is contained in:
David Danyi
2019-10-29 21:45:28 +01:00
commit 2cf81c493e
35 changed files with 3616 additions and 0 deletions

22
bin/automatique Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/php
<?php
require __DIR__ . '/../vendor/autoload.php';
use Interop\Container\ContainerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
/** @var ContainerInterface $container */
$container = require __DIR__ . '/../config/container.php';
/** @var Application $application */
$application = $container->get(Application::class);
$commands = $container->get('config')['console']['commands'];
foreach ($commands as $command) {
$application->add($container->get($command));
}
$lazyCommands = $container->get('config')['console']['lazy_commands'];
$lazyLoader = new ContainerCommandLoader($container, $lazyCommands);
$application->setCommandLoader($lazyLoader);
$application->run();

72
bin/build Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env php
<?php
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__ . '/../vendor/autoload.php';
define('ROOT', realpath(__DIR__ . '/..'));
$opt = getopt('v::');
$version = 'dev-master';
if (array_key_exists('v', $opt)) {
$version = $opt['v'];
if (!preg_match('/^\d+\.\d+\.\d+(-[\d\w\.]+)?$/i', $version)) {
die("Version number must follow semantic versioning.\n");
}
}
chdir(ROOT);
exec('composer install --no-dev');
$pharName = "automatique.phar";
$pharFile = ROOT . '/' . $pharName;
if (file_exists($pharFile)) {
unlink($pharFile);
}
$phar = new \Phar($pharFile, 0, $pharName);
$phar->setSignatureAlgorithm(\Phar::SHA1);
$phar->startBuffering();
$iterator = new RecursiveDirectoryIterator(ROOT, FilesystemIterator::SKIP_DOTS);
$iterator = new RecursiveCallbackFilterIterator($iterator, function (SplFileInfo $fileInfo) {
return !in_array($fileInfo->getBasename(), ['.git', 'Tests', 'test'], true);
});
$iterator = new RecursiveIteratorIterator($iterator);
$iterator = new CallbackFilterIterator($iterator, function (SplFileInfo $fileInfo) {
return in_array($fileInfo->getExtension(), ['php', 'exe'], true);
});
foreach ($iterator as $fileInfo) {
$file = str_replace(ROOT, '', $fileInfo->getRealPath());
echo "Add file: " . $file . "\n";
$phar->addFile($fileInfo->getRealPath(), $file);
}
// Add bin/dep file
$depContent = file_get_contents(ROOT . '/bin/automatique');
$depContent = str_replace("#!/usr/bin/php\n", '', $depContent);
$depContent = str_replace("'master'", "'$version'", $depContent);
$depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent);
$phar->addFromString('bin/automatique', $depContent);
$stub = <<<STUB
#!/usr/bin/env php
<?php
Phar::mapPhar('{$pharName}');
require 'phar://{$pharName}/bin/automatique';
__HALT_COMPILER();
STUB;
$phar->setStub($stub);
$phar->compressFiles(Phar::GZ);
$phar->stopBuffering();
unset($phar);
echo "$pharName was created successfully.\n";

View File

@@ -0,0 +1,48 @@
<?php
/**
* Script for clearing the configuration cache.
*
* Can also be invoked as `composer clear-config-cache`.
*
* @see https://github.com/zendframework/zend-expressive-skeleton for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
chdir(__DIR__ . '/../');
require 'vendor/autoload.php';
$config = include 'config/config.php';
if (! isset($config['config_cache_path'])) {
echo "No configuration cache path found" . PHP_EOL;
exit(0);
}
if (! file_exists($config['config_cache_path'])) {
printf(
"Configured config cache file '%s' not found%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);
}
if (false === unlink($config['config_cache_path'])) {
printf(
"Error removing config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(1);
}
printf(
"Removed configured config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);