From 8d8a0be19447631262558fb91c70ca0657a07ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kut=C3=A1=C4=8D?= Date: Wed, 31 Jul 2024 10:17:04 +0200 Subject: [PATCH] fix linter and deps --- .github/workflows/tests.yml | 2 +- .gitignore | 1 + composer.lock | 384 ----------------------------------- readme.md | 1 - src/Deployment/CliRunner.php | 9 +- src/Deployment/Deployer.php | 15 +- 6 files changed, 15 insertions(+), 397 deletions(-) delete mode 100644 composer.lock diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4dfd5be..1466aa7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.0', '8.1', '8.2', '8.3', '8.4'] + php: ['8.0', '8.1', '8.2', '8.3'] fail-fast: false diff --git a/.gitignore b/.gitignore index 1d90b35..334196a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /temp *.sublime-* *.phar +/composer.lock diff --git a/composer.lock b/composer.lock deleted file mode 100644 index e73af2f..0000000 --- a/composer.lock +++ /dev/null @@ -1,384 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "9c7c3fb77294666dad492d1eacd8a28e", - "packages": [ - { - "name": "paragonie/constant_time_encoding", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "shasum": "" - }, - "require": { - "php": "^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" - }, - "type": "library", - "autoload": { - "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" - } - ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", - "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" - }, - "time": "2020-12-06T15:14:20+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, - { - "name": "phpseclib/phpseclib", - "version": "3.0.7", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d", - "reference": "d369510df0ebd5e1a5d0fe3d4d23c55fa87a403d", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phing/phing": "~2.7", - "phpunit/phpunit": "^5.7|^6.0|^9.4", - "squizlabs/php_codesniffer": "~2.0" - }, - "suggest": { - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib3\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "support": { - "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.7" - }, - "funding": [ - { - "url": "https://github.com/terrafrost", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpseclib", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", - "type": "tidelift" - } - ], - "time": "2021-04-06T14:00:11+00:00" - } - ], - "packages-dev": [ - { - "name": "nette/tester", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/nette/tester.git", - "reference": "0988c33459b49bfd6c8d06e16f29de96eba341e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/tester/zipball/0988c33459b49bfd6c8d06e16f29de96eba341e7", - "reference": "0988c33459b49bfd6c8d06e16f29de96eba341e7", - "shasum": "" - }, - "require": { - "php": ">=7.2 <8.1" - }, - "require-dev": { - "ext-simplexml": "*", - "phpstan/phpstan": "^0.12" - }, - "bin": [ - "src/tester" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏", - "homepage": "https://tester.nette.org", - "keywords": [ - "Xdebug", - "assertions", - "clover", - "code coverage", - "nette", - "pcov", - "phpdbg", - "phpunit", - "testing", - "unit" - ], - "support": { - "issues": "https://github.com/nette/tester/issues", - "source": "https://github.com/nette/tester/tree/v2.4.0" - }, - "time": "2021-03-01T15:27:25+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "0.12.84", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c43f15da8798c8f30a4b099e6a94530a558cfd5", - "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "support": { - "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.84" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], - "time": "2021-04-19T17:10:54+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1", - "ext-zlib": "*" - }, - "platform-dev": { - "ext-curl": "*" - }, - "plugin-api-version": "2.0.0" -} diff --git a/readme.md b/readme.md index 4cfecee..509fb4a 100644 --- a/readme.md +++ b/readme.md @@ -65,4 +65,3 @@ ignoreTracked = " **Reason why I want this?** Sometimes I want to do a quick deploy, but first I have to run `composer install --no-dev`, run deployment, and run `composer install` which takes time. With this solution, it is possible to ignore the vendor folder, but keep those files tracked for future full deploy. - diff --git a/src/Deployment/CliRunner.php b/src/Deployment/CliRunner.php index 413dca9..3cc8c50 100644 --- a/src/Deployment/CliRunner.php +++ b/src/Deployment/CliRunner.php @@ -106,7 +106,7 @@ public function run(): ?int $time = time() - $time; $this->logger->log( 'Finished at ' . date('[Y/m/d H:i]') . " (in $time seconds)\n----------------------------------------------\n\n", - $res === 0 ? 'lime' : 'red' + $res === 0 ? 'lime' : 'red', ); return $res; } @@ -127,7 +127,7 @@ private function createDeployer(array $config): Deployer } $realFileOutputDir = realpath($config['fileoutputdir']); if (!$realFileOutputDir || !is_dir($realFileOutputDir) || !is_writable($realFileOutputDir)) { - throw new \Exception('FileOutputDir "'.$config['fileoutputdir'].'" is not writable a directory.'); + throw new \Exception('FileOutputDir "' . $config['fileoutputdir'] . '" is not writable a directory.'); } $config['fileoutputdir'] = $realFileOutputDir; } @@ -192,7 +192,9 @@ private function createDeployer(array $config): Deployer $deployment->runBefore = self::toArray($config['before'], true); $deployment->runAfterUpload = self::toArray($config['afterupload'], true); $deployment->runAfter = self::toArray($config['after'], true); - $deployment->fileOutputDir = empty($config['fileoutputdir']) ? null : $config['fileoutputdir']; + $deployment->fileOutputDir = empty($config['fileoutputdir']) + ? null + : $config['fileoutputdir']; $deployment->testMode = !empty($config['test']) || $this->mode === 'test'; return $deployment; @@ -238,7 +240,6 @@ private function setupPhp(): void private function loadConfig(): ?array { - $cmd = new CommandLine( <<<'XX' FTP deployment v3.6 - Pavel Kutáč edit diff --git a/src/Deployment/Deployer.php b/src/Deployment/Deployer.php index 1987da0..55217cb 100644 --- a/src/Deployment/Deployer.php +++ b/src/Deployment/Deployer.php @@ -204,6 +204,7 @@ public function deploy(): void } } + private function handleFileOutputMode(array $toUpload, array $toDelete): void { // OptimizedFolders array contains only folders wihtout files @@ -234,9 +235,9 @@ private function handleFileOutputMode(array $toUpload, array $toDelete): void if ($lastFolder) { $optimizedFolders[] = $lastFolder; } - file_put_contents($this->fileOutputDir.'/createDirs.txt', implode("\n", $folders)."\n"); - file_put_contents($this->fileOutputDir.'/createDirs.optimized.txt', implode("\n", $optimizedFolders)."\n"); - file_put_contents($this->fileOutputDir.'/changedFiles.txt', implode("\n", $files)."\n"); + file_put_contents($this->fileOutputDir . '/createDirs.txt', implode("\n", $folders) . "\n"); + file_put_contents($this->fileOutputDir . '/createDirs.optimized.txt', implode("\n", $optimizedFolders) . "\n"); + file_put_contents($this->fileOutputDir . '/changedFiles.txt', implode("\n", $files) . "\n"); // optimizedFiles array contains only files not included in any folder set to deletion // optimizedFolders array contains only folders not included in parent folder set to deletion @@ -259,10 +260,10 @@ private function handleFileOutputMode(array $toUpload, array $toDelete): void } } } - file_put_contents($this->fileOutputDir.'/removeDirs.optimized.txt', implode("\n", $optimizedFolders)."\n"); - file_put_contents($this->fileOutputDir.'/removeDirs.txt', implode("\n", $folders)."\n"); - file_put_contents($this->fileOutputDir.'/removeFiles.optimized.txt', implode("\n", $optimizedFiles)."\n"); - file_put_contents($this->fileOutputDir.'/removeFiles.txt', implode("\n", $files)."\n"); + file_put_contents($this->fileOutputDir . '/removeDirs.optimized.txt', implode("\n", $optimizedFolders) . "\n"); + file_put_contents($this->fileOutputDir . '/removeDirs.txt', implode("\n", $folders) . "\n"); + file_put_contents($this->fileOutputDir . '/removeFiles.optimized.txt', implode("\n", $optimizedFiles) . "\n"); + file_put_contents($this->fileOutputDir . '/removeFiles.txt', implode("\n", $files) . "\n"); }