Skip to content

Commit

Permalink
Release 7.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Oct 23, 2024
1 parent d122f61 commit df7d86e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 104 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
deployer.phar
.phpunit.result.cache
docker-compose.override.yml
.php-cs-fixer.cache
94 changes: 1 addition & 93 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,5 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if (ini_get('phar.readonly') === '1') {
throw new \Exception('Writing to phar files is disabled. Change your `php.ini` or append `-d phar.readonly=false` to the shebang, if supported by your `env` executable.');
}

define('__ROOT__', realpath(__DIR__ . '/..'));
chdir(__ROOT__);

$opt = getopt('v:', ['nozip']);

$version = $opt['v'] ?? null;
if (empty($version)) {
echo "Please, specify version as \"-v8.0.0\".\n";
exit(1);
}
if (!preg_match('/^\d+\.\d+\.\d+(\-\w+(\.\d+)?)?$/', $version)) {
echo "Version must be \"7.0.0-beta.42\". Got \"$version\".\n";
exit(1);
}

$pharName = "deployer.phar";
$pharFile = __ROOT__ . '/' . $pharName;
if (file_exists($pharFile)) {
unlink($pharFile);
}

$ignore = [
'.anton',
'.git',
'Tests',
'tests',
'deploy.php',
'.php-cs-fixer.dist.php',
];

$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) use ($ignore) {
return !in_array($fileInfo->getBasename(), $ignore, true);
});
$iterator = new RecursiveIteratorIterator($iterator);
$iterator = new CallbackFilterIterator($iterator, function (SplFileInfo $fileInfo) {
//'bash', 'fish', 'zsh' is a completion templates
return in_array($fileInfo->getExtension(), ['php', 'exe', 'bash', 'fish', 'zsh'], true);
});

foreach ($iterator as $fileInfo) {
$file = str_replace(__ROOT__, '', $fileInfo->getRealPath());
echo "+ " . $file . "\n";
$phar->addFile($fileInfo->getRealPath(), $file);

if (!array_key_exists('nozip', $opt)) {
$phar[$file]->compress(Phar::GZ);

if (!$phar[$file]->isCompressed()) {
echo "Could not compress File: $file\n";
}
}
}

// Add schema.json
echo "+ /src/schema.json\n";
$phar->addFile(realpath(__DIR__ . '/../src/schema.json'), '/src/schema.json');

// Add Caddyfile
echo "+ /recipe/provision/Caddyfile\n";
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/Caddyfile'), '/recipe/provision/Caddyfile');

// Add 404.html
echo "+ /recipe/provision/404.html\n";
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/404.html'), '/recipe/provision/404.html');

// Add bin/dep file
echo "+ /bin/dep\n";
$depContent = file_get_contents(__ROOT__ . '/bin/dep');
$depContent = str_replace("#!/usr/bin/env php\n", '', $depContent);
$depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent);
$depContent = preg_replace("/run\('.+?'/", "run('$version'", $depContent);
$phar->addFromString('bin/dep', $depContent);

$phar->setStub(
<<<STUB
#!/usr/bin/env php
<?php
Phar::mapPhar('{$pharName}');
require 'phar://{$pharName}/bin/dep';
__HALT_COMPILER();
STUB
);
$phar->stopBuffering();
unset($phar);

echo "$pharName was created successfully.\n";
echo "No nothing.\n";
Binary file modified bin/dep
Binary file not shown.
10 changes: 0 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
"url": "https://github.com/sponsors/antonmedv"
}
],
"autoload": {
"psr-4": {
"Deployer\\": "src/"
},
"files": [
"vendor/autoload.php",
"src/Support/helpers.php",
"src/functions.php"
]
},
"scripts": {
"test": "pest",
"test:e2e": "pest --config tests/e2e/phpunit-e2e.xml",
Expand Down
Binary file added deployer.phar
Binary file not shown.

0 comments on commit df7d86e

Please sign in to comment.