From 3e1f14e14467f774fc81e86d94ab783251f3b951 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Thu, 10 Sep 2020 18:06:31 +0800 Subject: [PATCH 1/7] WIP install command --- composer.json | 5 +- composer.lock | 2098 +++++++++++++++++++++++++++++- src/BaseCommand.php | 73 +- src/Commands/Install/Command.php | 422 ++++++ 4 files changed, 2583 insertions(+), 15 deletions(-) create mode 100644 src/Commands/Install/Command.php diff --git a/composer.json b/composer.json index 4f6e37e..3f76655 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,14 @@ "require": { "php": ">=7.2", "symfony/console": "^4.4.13", + "symfony/process": "^4.4.13", "php-http/guzzle6-adapter": "^2.0", "knplabs/github-api": "^2.15" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4" + "bamarni/composer-bin-plugin": "^1.4", + "phpunit/phpunit": "^8.0|^9.0", + "php-parallel-lint/php-parallel-lint": "^1.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 10e471d..94cdd7d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "55c34f16ca5058aa7ac0b8f96a34a9e6", + "content-hash": "ee9692cf7b2a45770135907b40fc3ea5", "packages": [ { "name": "clue/stream-filter", @@ -1234,16 +1234,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.1.3", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5e20b83385a77593259c9f8beb2c43cd03b2ac14" + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5e20b83385a77593259c9f8beb2c43cd03b2ac14", - "reference": "5e20b83385a77593259c9f8beb2c43cd03b2ac14", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", "shasum": "" }, "require": { @@ -1252,7 +1252,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" }, "thanks": { "name": "symfony/contracts", @@ -1294,7 +1294,7 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:49:21+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/options-resolver", @@ -1915,18 +1915,81 @@ ], "time": "2020-07-14T12:35:20+00:00" }, + { + "name": "symfony/process", + "version": "v4.4.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", + "shasum": "" + }, + "require": { + "php": ">=7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-23T08:31:43+00:00" + }, { "name": "symfony/service-contracts", - "version": "v2.1.3", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "58c7475e5457c5492c26cc740cc0ad7464be9442" + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/58c7475e5457c5492c26cc740cc0ad7464be9442", - "reference": "58c7475e5457c5492c26cc740cc0ad7464be9442", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", "shasum": "" }, "require": { @@ -1939,7 +2002,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" }, "thanks": { "name": "symfony/contracts", @@ -1989,7 +2052,7 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:23:11+00:00" + "time": "2020-09-07T11:33:47+00:00" } ], "packages-dev": [ @@ -2038,6 +2101,2015 @@ "tool" ], "time": "2020-05-03T08:27:20+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-05-29T17:27:14+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.9.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/88e519766fc58bd46b8265561fb79b54e2e00b28", + "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2020-08-30T16:15:20+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2020-06-27T14:33:11+00:00" + }, + { + "name": "phar-io/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/c6bb6825def89e0a32220f88337f8ceaf1975fa0", + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2020-06-27T14:39:04+00:00" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "474f18bc6cc6aca61ca40bfab55139de614e51ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/474f18bc6cc6aca61ca40bfab55139de614e51ca", + "reference": "474f18bc6cc6aca61ca40bfab55139de614e51ca", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.4.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "~0.3", + "squizlabs/php_codesniffer": "~3.0" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "time": "2020-04-04T12:18:32+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-08-15T11:14:08+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-06-27T10:12:23+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2", + "phpdocumentor/reflection-docblock": "^5.0", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2020-07-08T12:44:21+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.1.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "f98f8466126d83b55b924a94d2244c53c216b8fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f98f8466126d83b55b924a94d2244c53c216b8fb", + "reference": "f98f8466126d83b55b924a94d2244c53c216b8fb", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.8", + "php": "^7.3 || ^8.0", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-07T08:07:10+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-11T05:18:21+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-06T07:04:15+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:55:37+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:58:13+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c", + "reference": "93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": "^7.3 || ^8.0", + "phpspec/prophecy": "^1.11.1", + "phpunit/php-code-coverage": "^9.1.5", + "phpunit/php-file-iterator": "^3.0.4", + "phpunit/php-invoker": "^3.1", + "phpunit/php-text-template": "^2.0.2", + "phpunit/php-timer": "^5.0.1", + "sebastian/cli-parser": "^1.0", + "sebastian/code-unit": "^1.0.5", + "sebastian/comparator": "^4.0.3", + "sebastian/diff": "^4.0.2", + "sebastian/environment": "^5.1.2", + "sebastian/exporter": "^4.0.2", + "sebastian/global-state": "^5.0", + "sebastian/object-enumerator": "^4.0.2", + "sebastian/resource-operations": "^3.0.2", + "sebastian/type": "^2.2.1", + "sebastian/version": "^3.0.1" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-27T06:30:58+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2a4a38c56e62f7295bedb8b1b7439ad523d4ea82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2a4a38c56e62f7295bedb8b1b7439ad523d4ea82", + "reference": "2a4a38c56e62f7295bedb8b1b7439ad523d4ea82", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-12T10:49:21+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:50:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:04:00+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:05:46+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/33fcd6a26656c6546f70871244ecba4b4dced097", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-25T14:01:34+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-30T04:46:02+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:07:24+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:08:55+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "22ae663c951bdc39da96603edc3239ed3a299097" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/22ae663c951bdc39da96603edc3239ed3a299097", + "reference": "22ae663c951bdc39da96603edc3239ed3a299097", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-07T04:09:03+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e02bf626f404b5daec382a7b8a6a4456e49017e5", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-22T18:33:42+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:11:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "127a46f6b057441b201253526f81d5406d6c7840" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:12:55+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:14:17+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0653718a5a629b065e91f774595267f8dc32e213" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-05T08:31:53+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:18:43+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], diff --git a/src/BaseCommand.php b/src/BaseCommand.php index d82db15..628117e 100644 --- a/src/BaseCommand.php +++ b/src/BaseCommand.php @@ -1,9 +1,11 @@ input = $input; $this->output = $output; // Add success style @@ -141,4 +147,69 @@ protected function error(string $text, int $verbosity = OutputInterface::VERBOSI { $this->output->writeln('' . $text . '', $verbosity); } + + /** + * Prompts the user for an answer to a question. + * + * @param string $text + * @param mixed $default + * @param bool $hidden + * @return mixed + */ + protected function prompt(string $question, $default = null, bool $hidden = false) + { + $askHelper = $this->getHelper('question'); + + $prompt = PHP_EOL . ' ' . $question; + if (!is_null($default)) { + $prompt .= ' [' . (string) $default . ']'; + } + $prompt .= PHP_EOL . ' > '; + + $questionObj = new Question($prompt, $default); + if ($hidden) { + $questionObj->setHidden(true); + $questionObj->setHiddenFallback(false); + } + + return $askHelper->ask( + $this->input, + $this->output, + $questionObj + ); + } + + /** + * Prompts the user for a number as an answer to a question + * + * @param string $text + * @param int|null $default + * @return int + */ + protected function promptInt(string $question, ?int $default = null): int + { + $askHelper = $this->getHelper('question'); + + $prompt = PHP_EOL . ' ' . $question; + if (!is_null($default)) { + $prompt .= ' [' . (string) $default . ']'; + } + $prompt .= PHP_EOL . ' > '; + + $questionObj = new Question($prompt, $default); + $questionObj->setValidator(function ($answer) { + if (!is_int($answer)) { + throw new RuntimeException('Value must be a number'); + } + + return $answer; + }); + $questionObj->setMaxAttempts(2); + + return (int) $askHelper->ask( + $this->input, + $this->output, + $questionObj + ); + } } diff --git a/src/Commands/Install/Command.php b/src/Commands/Install/Command.php new file mode 100644 index 0000000..f5f4a08 --- /dev/null +++ b/src/Commands/Install/Command.php @@ -0,0 +1,422 @@ +setDescription('Installs October CMS.') + + // the full command description shown when running the command with + // the "--help" option + ->setHelp( + 'This command allows you to install October CMS into a specified path.' . PHP_EOL . PHP_EOL . + 'Three types of installation are available:' . PHP_EOL . + ' - Easy install: Installs October CMS using the October CMS marketplace.' . PHP_EOL . + ' - Composer install: Installs October CMS using Composer.' . PHP_EOL . + ' - Contributor install: Installs October CMS using Composer, and sets up the installation in order' . + ' to allow the user to contribute to October CMS.' + ) + + // arguments + ->addArgument( + 'path', + InputArgument::OPTIONAL, + 'The path to the October CMS project.' + ) + + // options + ->addOption( + 'composer', + 'c', + InputOption::VALUE_NONE, + 'Installs October CMS using Composer.' + ) + ->addOption( + 'contributor', + null, + InputOption::VALUE_NONE, + 'Installs October CMS using Composer, and sets up the installation in order' . + ' to allow the user to contribute to October CMS.' + ) + ->addOption( + 'easy', + 'e', + InputOption::VALUE_NONE, + 'Installs October CMS using the October CMS marketplace.' + ) + ->addOption( + 'force', + 'f', + InputOption::VALUE_NONE, + 'Forces the installation of October CMS (will delete any files within the path specified).' + ) + // settings options + ->addOption( + 'app-name', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the name of the October CMS project.' + ) + ->addOption( + 'app-url', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the URL of the October CMS project.' + ) + ->addOption( + 'db-type', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database type.' + ) + ->addOption( + 'db-host', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database host.' + ) + ->addOption( + 'db-port', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database port.' + ) + ->addOption( + 'db-name', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database name (or storage path).' + ) + ->addOption( + 'db-user', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database username.' + ) + ->addOption( + 'db-pass', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the database password.' + ) + ; + } + + /** + * @inheritDoc + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $askHelper = $this->getHelper('question'); + + // Determine installation mode + if ($input->getOption('composer')) { + $mode = 'composer'; + } elseif ($input->getOption('contributor')) { + $mode = 'contributor'; + } elseif ($input->getOption('easy')) { + $mode = 'easy'; + } else { + $question = new ChoiceQuestion( + PHP_EOL . + 'Please select the installation type.' . PHP_EOL . PHP_EOL . + ' - Easy install (easy): (default) Installs October CMS using the October CMS' . + ' marketplace.' . PHP_EOL . + ' - Composer install (composer): Installs October CMS using Composer.' . PHP_EOL . + ' - Contributor install (contributor): Installs October CMS using Composer, and sets up' . + ' the installation in order to allow the user to contribute to October CMS.' . PHP_EOL, + ['easy', 'composer', 'contributor'], + 'easy' + ); + $mode = $askHelper->ask($input, $output, $question); + } + + // Check (or clear) the current path + $path = $input->getArgument('path') ?? getcwd(); + if ($path === '.') { + $path = getcwd(); + } + + if (!$input->getOption('force') || $path === getcwd()) { + $this->comment('Checking path is empty...', OutputInterface::VERBOSITY_VERBOSE); + $this->checkPathIsEmpty($path); + } else { + $this->comment('Clearing path...', OutputInterface::VERBOSITY_VERBOSE); + $this->clearPath($input, $output, $path); + } + + // Create path if required + if (!file_exists($path)) { + try { + $this->comment('Creating empty directory in path...', OutputInterface::VERBOSITY_VERBOSE); + mkdir($path, 0755, true); + } catch (Throwable $e) { + throw new Exception('Cannot create directory "' . $path . '" - ' . $e->getMessage()); + } + } + + $this->getAppSettings($input, $output); + $this->getDbSettings($input, $output); + + print_r([ + 'appName' => $this->appName, + 'appUrl' => $this->appUrl, + 'dbType' => $this->dbType, + 'dbHost' => $this->dbHost, + 'dbPort' => $this->dbPort, + 'dbName' => $this->dbName, + 'dbUser' => $this->dbUser, + 'dbPass' => $this->dbPass, + ]); + die(); + + // switch ($mode) { + // case 'easy': + // $this->doEasyInstall($input, $output, $path); + // break; + // case 'composer': + // $this->doComposerInstall($input, $output, $path); + // break; + // case 'contributor': + // $this->doContributorInstall($input, $output, $path); + // break; + // } + } + + /** + * Checks that a given path is empty. + * + * A path is considered empty if it doesn't exist, or is a directory with no files or subfolders within. + * + * @param string $path + * @return void + * @throws Exception if path is not empty + * @throws Exception if path is a file + */ + protected function checkPathIsEmpty(string $path): void + { + if (!file_exists($path)) { + return; + } + + if (is_dir($path)) { + $iterator = new DirectoryIterator($path); + foreach ($iterator as $item) { + if ($item->isDot()) { + continue; + } + // If a file or subfolder is found, break out at this point + if ($item->isFile() || $item->isLink() || $item->isDir()) { + $message = 'Path "' . $path . '" is not empty.'; + if ($path === getcwd()) { + $message .= ' Please clear out the current directory to install October CMS here.'; + } else { + $message .= 'Use the --force option to ignore this.'; + } + throw new Exception($message); + } + } + } + + if (is_file($path)) { + throw new Exception('Path "' . $path . '" is a file. You must install October CMS in a directory.'); + } + } + + /** + * Clears a path, and all its files and subfolders. + * + * @param InputInterface $input + * @param OutputInterface $output + * @param string $path + * @return void + * @throws Exception If path is a file + */ + protected function clearPath(InputInterface $input, OutputInterface $output, string $path): void + { + if (!file_exists($path)) { + return; + } + if (is_file($path)) { + throw new Exception('Path "' . $path . '" is a file. You must install October CMS in a directory.'); + } + + // Remove the path completely + if (PHP_OS_FAMILY == 'Windows') { + $command = 'rd /s /q "' . $path . '"'; + } else { + $command = 'rm -rf "' . $path . '"'; + } + + $this->runCommand($input, $output, $command); + } + + protected function getAppSettings(InputInterface $input, OutputInterface $output) + { + $this->info('Determine application settings', OutputInterface::VERBOSITY_VERBOSE); + + // Application name + $this->appName = $input->getOption('app-name') ?? $this->prompt('Application name?', $this->appName); + + // Application URL + $this->appUrl = $input->getOption('app-url') ?? $this->prompt('Application URL', $this->appUrl); + } + + protected function getDbSettings(InputInterface $input, OutputInterface $output) + { + $this->info('Determine database settings', OutputInterface::VERBOSITY_VERBOSE); + + $dbTypes = [ + 'mysql', + 'postgres', + 'sqlite', + 'sqlserver' + ]; + + if (is_null($input->getOption('db-type')) || !in_array($input->getOption('db-type'), $dbTypes)) { + $askHelper = $this->getHelper('question'); + + $question = new ChoiceQuestion( + PHP_EOL . + 'Please select the database type you wish to use.' . PHP_EOL . PHP_EOL . + ' - mysql: (default) MySQL / MariaDB' . + ' marketplace.' . PHP_EOL . + ' - postgres: PostgreSQL.' . PHP_EOL . + ' - sqlite: SQLite' . PHP_EOL . + ' - sqlserver: Microsoft SQL Server' . PHP_EOL, + $dbTypes, + 'mysql' + ); + $this->dbType = $askHelper->ask($input, $output, $question); + } + + switch ($this->dbType) { + case 'mysql': + $this->getMysqlSettings($input, $output); + break; + case 'postgres': + $this->getPostgresSettings($input, $output); + break; + case 'sqlite': + $this->getSqliteSettings($input, $output); + break; + case 'sqlserver': + $this->getSqlServerSettings($input, $output); + break; + } + } + + protected function getMysqlSettings(InputInterface $input, OutputInterface $output) + { + // Database host + $this->dbHost = $input->getOption('db-host') ?? $this->prompt('MySQL host address?', 'localhost'); + + // Database port + $this->dbPort = $input->getOption('db-port') ?? $this->promptInt('MySQL port', 3306); + + // Database name + $this->dbName = $input->getOption('db-name') ?? $this->prompt('Database name?', $this->dbName); + + // Database username + $this->dbUser = $input->getOption('db-user') ?? $this->prompt('MySQL username?', $this->dbUser); + + // Database password + $this->dbPass = $input->getOption('db-pass') ?? $this->prompt('MySQL password?', $this->dbPass, true); + } + + protected function getPostgresSettings(InputInterface $input, OutputInterface $output) + { + // Database host + $this->dbHost = $input->getOption('db-host') ?? $this->prompt('PostgreSQL host address?', 'localhost'); + + // Database port + $this->dbPort = $input->getOption('db-port') ?? $this->promptInt('PostgreSQL port', 5432); + + // Database name + $this->dbName = $input->getOption('db-name') ?? $this->prompt('Database name?', $this->dbName); + + // Database username + $this->dbName = $input->getOption('db-user') ?? $this->prompt('PostgreSQL username?', $this->dbName); + + // Database password + $this->dbName = $input->getOption('db-pass') ?? $this->prompt('PostgreSQL password?', $this->dbName, true); + } + + + protected function runCommand(InputInterface $input, OutputInterface $output, string $command): Process + { + if ($input->getOption('no-ansi')) { + $command .= ' --no-ansi'; + } + + if ($input->getOption('quiet')) { + $command .= ' --quiet'; + } + + $process = Process::fromShellCommandline($command, null, null, null, null); + + if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { + try { + $process->setTty(true); + } catch (RuntimeException $e) { + $output->writeln('Warning: ' . $e->getMessage()); + } + } + + $process->run(function ($type, $line) use ($output) { + $output->write(' ' . $line); + }); + + return $process; + } +} From c41f957297cf43c42e8dd5390fff232df822cc74 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 11 Sep 2020 17:19:31 +0800 Subject: [PATCH 2/7] Fix int check --- src/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaseCommand.php b/src/BaseCommand.php index 628117e..64ec0bd 100644 --- a/src/BaseCommand.php +++ b/src/BaseCommand.php @@ -198,7 +198,7 @@ protected function promptInt(string $question, ?int $default = null): int $questionObj = new Question($prompt, $default); $questionObj->setValidator(function ($answer) { - if (!is_int($answer)) { + if (!preg_match('/^(0|-?[1-9][0-9]*)$/', $answer)) { throw new RuntimeException('Value must be a number'); } From d5a3054827f824e152c5182c9c135c3fb6efa742 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 11 Sep 2020 17:19:40 +0800 Subject: [PATCH 3/7] Further WIP --- src/Commands/Install/Command.php | 70 +++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/Commands/Install/Command.php b/src/Commands/Install/Command.php index f5f4a08..ab8247c 100644 --- a/src/Commands/Install/Command.php +++ b/src/Commands/Install/Command.php @@ -207,18 +207,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getAppSettings($input, $output); $this->getDbSettings($input, $output); - - print_r([ - 'appName' => $this->appName, - 'appUrl' => $this->appUrl, - 'dbType' => $this->dbType, - 'dbHost' => $this->dbHost, - 'dbPort' => $this->dbPort, - 'dbName' => $this->dbName, - 'dbUser' => $this->dbUser, - 'dbPass' => $this->dbPass, - ]); - die(); + $this->getAdminSettings($input, $output); // switch ($mode) { // case 'easy': @@ -231,6 +220,18 @@ protected function execute(InputInterface $input, OutputInterface $output) // $this->doContributorInstall($input, $output, $path); // break; // } + + print_r([ + 'appName' => $this->appName, + 'appUrl' => $this->appUrl, + 'dbType' => $this->dbType, + 'dbHost' => $this->dbHost, + 'dbPort' => $this->dbPort, + 'dbName' => $this->dbName, + 'dbUser' => $this->dbUser, + 'dbPass' => $this->dbPass, + ]); + die(); } /** @@ -318,9 +319,9 @@ protected function getDbSettings(InputInterface $input, OutputInterface $output) $dbTypes = [ 'mysql', - 'postgres', + 'pgsql', 'sqlite', - 'sqlserver' + 'sqlsrv' ]; if (is_null($input->getOption('db-type')) || !in_array($input->getOption('db-type'), $dbTypes)) { @@ -331,9 +332,9 @@ protected function getDbSettings(InputInterface $input, OutputInterface $output) 'Please select the database type you wish to use.' . PHP_EOL . PHP_EOL . ' - mysql: (default) MySQL / MariaDB' . ' marketplace.' . PHP_EOL . - ' - postgres: PostgreSQL.' . PHP_EOL . + ' - pgsql: PostgreSQL.' . PHP_EOL . ' - sqlite: SQLite' . PHP_EOL . - ' - sqlserver: Microsoft SQL Server' . PHP_EOL, + ' - sqlsrv: Microsoft SQL Server' . PHP_EOL, $dbTypes, 'mysql' ); @@ -344,13 +345,13 @@ protected function getDbSettings(InputInterface $input, OutputInterface $output) case 'mysql': $this->getMysqlSettings($input, $output); break; - case 'postgres': + case 'pgsql': $this->getPostgresSettings($input, $output); break; case 'sqlite': $this->getSqliteSettings($input, $output); break; - case 'sqlserver': + case 'sqlsrv': $this->getSqlServerSettings($input, $output); break; } @@ -386,12 +387,41 @@ protected function getPostgresSettings(InputInterface $input, OutputInterface $o $this->dbName = $input->getOption('db-name') ?? $this->prompt('Database name?', $this->dbName); // Database username - $this->dbName = $input->getOption('db-user') ?? $this->prompt('PostgreSQL username?', $this->dbName); + $this->dbUser = $input->getOption('db-user') ?? $this->prompt('PostgreSQL username?', $this->dbUser); // Database password - $this->dbName = $input->getOption('db-pass') ?? $this->prompt('PostgreSQL password?', $this->dbName, true); + $this->dbPass = $input->getOption('db-pass') ?? $this->prompt('PostgreSQL password?', $this->dbPass, true); + } + + protected function getSqliteSettings(InputInterface $input, OutputInterface $output) + { + // Database path + $this->dbName = $input->getOption('db-name') ?? $this->prompt( + 'SQLite database path?', + 'storage/database.sqlite', + ); } + protected function getSqlServerSettings(InputInterface $input, OutputInterface $output) + { + // Database host + $this->dbHost = $input->getOption('db-host') ?? $this->prompt( + 'SQL Server host address?', + '192.168.0.1\\SQLEXPRESS' + ); + + // Database port + $this->dbPort = $input->getOption('db-port') ?? $this->promptInt('SQL Server port', 1433); + + // Database name + $this->dbName = $input->getOption('db-name') ?? $this->prompt('Database name?', $this->dbName); + + // Database username + $this->dbUser = $input->getOption('db-user') ?? $this->prompt('SQL Server username?', $this->dbUser); + + // Database password + $this->dbPass = $input->getOption('db-pass') ?? $this->prompt('SQL Server password?', $this->dbPass, true); + } protected function runCommand(InputInterface $input, OutputInterface $output, string $command): Process { From 6d6f6ddad63077748c94fe4239af7f7dbaea1be9 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Sat, 3 Oct 2020 23:46:29 +0800 Subject: [PATCH 4/7] Further WIP --- composer.lock | 360 +++++++++++++++---------------- src/Commands/Install/Command.php | 217 ++++++++++++++++--- 2 files changed, 373 insertions(+), 204 deletions(-) diff --git a/composer.lock b/composer.lock index 89399db..f4ffbd1 100644 --- a/composer.lock +++ b/composer.lock @@ -1927,16 +1927,16 @@ }, { "name": "symfony/process", - "version": "v4.4.13", + "version": "v4.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" + "reference": "9b887acc522935f77555ae8813495958c7771ba7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", + "url": "https://api.github.com/repos/symfony/process/zipball/9b887acc522935f77555ae8813495958c7771ba7", + "reference": "9b887acc522935f77555ae8813495958c7771ba7", "shasum": "" }, "require": { @@ -1986,7 +1986,7 @@ "type": "tidelift" } ], - "time": "2020-07-23T08:31:43+00:00" + "time": "2020-09-02T16:08:58+00:00" }, { "name": "symfony/service-contracts", @@ -2238,16 +2238,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.9.1", + "version": "v4.10.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28" + "reference": "658f1be311a230e0907f5dfe0213742aff0596de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/88e519766fc58bd46b8265561fb79b54e2e00b28", - "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", + "reference": "658f1be311a230e0907f5dfe0213742aff0596de", "shasum": "" }, "require": { @@ -2286,7 +2286,7 @@ "parser", "php" ], - "time": "2020-08-30T16:15:20+00:00" + "time": "2020-09-26T10:30:38+00:00" }, { "name": "phar-io/manifest", @@ -2495,16 +2495,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.1", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { @@ -2543,20 +2543,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-08-15T11:14:08+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -2588,32 +2588,32 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "1.11.1", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2", - "phpdocumentor/reflection-docblock": "^5.0", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0 || ^9.0 <9.3" }, "type": "library", "extra": { @@ -2651,20 +2651,20 @@ "spy", "stub" ], - "time": "2020-07-08T12:44:21+00:00" + "time": "2020-09-29T09:10:42+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.1.8", + "version": "9.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f98f8466126d83b55b924a94d2244c53c216b8fb" + "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f98f8466126d83b55b924a94d2244c53c216b8fb", - "reference": "f98f8466126d83b55b924a94d2244c53c216b8fb", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53a4b737e83be724efd2bc4e7b929b9a30c48972", + "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972", "shasum": "" }, "require": { @@ -2672,7 +2672,7 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.8", - "php": "^7.3 || ^8.0", + "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", "sebastian/code-unit-reverse-lookup": "^2.0.2", @@ -2692,7 +2692,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.1-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -2724,27 +2724,27 @@ "type": "github" } ], - "time": "2020-09-07T08:07:10+00:00" + "time": "2020-10-02T03:37:32+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", - "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -2780,28 +2780,28 @@ "type": "github" } ], - "time": "2020-07-11T05:18:21+00:00" + "time": "2020-09-28T05:57:25+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", - "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-pcntl": "*" @@ -2839,27 +2839,27 @@ "type": "github" } ], - "time": "2020-08-06T07:04:15+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" + "reference": "18c887016e60e52477e54534956d7b47bc52cd84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", - "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/18c887016e60e52477e54534956d7b47bc52cd84", + "reference": "18c887016e60e52477e54534956d7b47bc52cd84", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -2894,27 +2894,27 @@ "type": "github" } ], - "time": "2020-06-26T11:55:37+00:00" + "time": "2020-09-28T06:03:05+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" + "reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", - "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/c9ff14f493699e2f6adee9fd06a0245b276643b7", + "reference": "c9ff14f493699e2f6adee9fd06a0245b276643b7", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -2949,20 +2949,20 @@ "type": "github" } ], - "time": "2020-06-26T11:58:13+00:00" + "time": "2020-09-28T06:00:25+00:00" }, { "name": "phpunit/phpunit", - "version": "9.3.8", + "version": "9.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c" + "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c", - "reference": "93d78d8e2a06393a0d0c1ead6fe9984f1af1f88c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef533467a7974c4b6c354f3eff42a115910bd4e5", + "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5", "shasum": "" }, "require": { @@ -2976,9 +2976,9 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.1", "phar-io/version": "^3.0.2", - "php": "^7.3 || ^8.0", + "php": ">=7.3", "phpspec/prophecy": "^1.11.1", - "phpunit/php-code-coverage": "^9.1.5", + "phpunit/php-code-coverage": "^9.2", "phpunit/php-file-iterator": "^3.0.4", "phpunit/php-invoker": "^3.1", "phpunit/php-text-template": "^2.0.2", @@ -3009,7 +3009,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.3-dev" + "dev-master": "9.4-dev" } }, "autoload": { @@ -3048,24 +3048,24 @@ "type": "github" } ], - "time": "2020-08-27T06:30:58+00:00" + "time": "2020-10-02T03:54:37+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2a4a38c56e62f7295bedb8b1b7439ad523d4ea82" + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2a4a38c56e62f7295bedb8b1b7439ad523d4ea82", - "reference": "2a4a38c56e62f7295bedb8b1b7439ad523d4ea82", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { "phpunit/phpunit": "^9.3" @@ -3100,27 +3100,27 @@ "type": "github" } ], - "time": "2020-08-12T10:49:21+00:00" + "time": "2020-09-28T06:08:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.5", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "c1e2df332c905079980b119c4db103117e5e5c90" + "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", - "reference": "c1e2df332c905079980b119c4db103117e5e5c90", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/59236be62b1bb9919e6d7f60b0b832dc05cef9ab", + "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3152,27 +3152,27 @@ "type": "github" } ], - "time": "2020-06-26T12:50:45+00:00" + "time": "2020-10-02T14:47:54+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", - "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3203,29 +3203,29 @@ "type": "github" } ], - "time": "2020-06-26T12:04:00+00:00" + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.3", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" + "reference": "7a8ff306445707539c1a6397372a982a1ec55120" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", - "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/7a8ff306445707539c1a6397372a982a1ec55120", + "reference": "7a8ff306445707539c1a6397372a982a1ec55120", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0", + "php": ">=7.3", "sebastian/diff": "^4.0", "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3273,28 +3273,28 @@ "type": "github" } ], - "time": "2020-06-26T12:05:46+00:00" + "time": "2020-09-30T06:47:25+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "33fcd6a26656c6546f70871244ecba4b4dced097" + "reference": "ba8cc2da0c0bfbc813d03b56406734030c7f1eff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/33fcd6a26656c6546f70871244ecba4b4dced097", - "reference": "33fcd6a26656c6546f70871244ecba4b4dced097", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ba8cc2da0c0bfbc813d03b56406734030c7f1eff", + "reference": "ba8cc2da0c0bfbc813d03b56406734030c7f1eff", "shasum": "" }, "require": { "nikic/php-parser": "^4.7", - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3326,27 +3326,27 @@ "type": "github" } ], - "time": "2020-07-25T14:01:34+00:00" + "time": "2020-09-28T06:05:03+00:00" }, { "name": "sebastian/diff", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" + "reference": "ffc949a1a2aae270ea064453d7535b82e4c32092" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", - "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ffc949a1a2aae270ea064453d7535b82e4c32092", + "reference": "ffc949a1a2aae270ea064453d7535b82e4c32092", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^9.3", "symfony/process": "^4.2 || ^5" }, "type": "library", @@ -3388,27 +3388,27 @@ "type": "github" } ], - "time": "2020-06-30T04:46:02+00:00" + "time": "2020-09-28T05:32:55+00:00" }, { "name": "sebastian/environment", - "version": "5.1.2", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", - "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -3416,7 +3416,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -3447,29 +3447,29 @@ "type": "github" } ], - "time": "2020-06-26T12:07:24+00:00" + "time": "2020-09-28T05:52:38+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "571d721db4aec847a0e59690b954af33ebf9f023" + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", - "reference": "571d721db4aec847a0e59690b954af33ebf9f023", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0", + "php": ">=7.3", "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^9.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3520,24 +3520,24 @@ "type": "github" } ], - "time": "2020-06-26T12:08:55+00:00" + "time": "2020-09-28T05:24:23+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "22ae663c951bdc39da96603edc3239ed3a299097" + "reference": "ea779cb749a478b22a2564ac41cd7bda79c78dc7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/22ae663c951bdc39da96603edc3239ed3a299097", - "reference": "22ae663c951bdc39da96603edc3239ed3a299097", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ea779cb749a478b22a2564ac41cd7bda79c78dc7", + "reference": "ea779cb749a478b22a2564ac41cd7bda79c78dc7", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0", + "php": ">=7.3", "sebastian/object-reflector": "^2.0", "sebastian/recursion-context": "^4.0" }, @@ -3580,28 +3580,28 @@ "type": "github" } ], - "time": "2020-08-07T04:09:03+00:00" + "time": "2020-09-28T05:54:06+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5" + "reference": "6514b8f21906b8b46f520d1fbd17a4523fa59a54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e02bf626f404b5daec382a7b8a6a4456e49017e5", - "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/6514b8f21906b8b46f520d1fbd17a4523fa59a54", + "reference": "6514b8f21906b8b46f520d1fbd17a4523fa59a54", "shasum": "" }, "require": { "nikic/php-parser": "^4.6", - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3633,29 +3633,29 @@ "type": "github" } ], - "time": "2020-07-22T18:33:42+00:00" + "time": "2020-09-28T06:07:27+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + "reference": "f6f5957013d84725427d361507e13513702888a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", - "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f6f5957013d84725427d361507e13513702888a4", + "reference": "f6f5957013d84725427d361507e13513702888a4", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0", + "php": ">=7.3", "sebastian/object-reflector": "^2.0", "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3686,27 +3686,27 @@ "type": "github" } ], - "time": "2020-06-26T12:11:32+00:00" + "time": "2020-09-28T05:55:06+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "127a46f6b057441b201253526f81d5406d6c7840" + "reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", - "reference": "127a46f6b057441b201253526f81d5406d6c7840", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5", + "reference": "d9d0ab3b12acb1768bc1e0a89b23c90d2043cbe5", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3737,27 +3737,27 @@ "type": "github" } ], - "time": "2020-06-26T12:12:55+00:00" + "time": "2020-09-28T05:56:16+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" + "reference": "ed8c9cd355089134bc9cba421b5cfdd58f0eaef7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", - "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/ed8c9cd355089134bc9cba421b5cfdd58f0eaef7", + "reference": "ed8c9cd355089134bc9cba421b5cfdd58f0eaef7", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3796,24 +3796,24 @@ "type": "github" } ], - "time": "2020-06-26T12:14:17+00:00" + "time": "2020-09-28T05:17:32+00:00" }, { "name": "sebastian/resource-operations", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0653718a5a629b065e91f774595267f8dc32e213" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", - "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { "phpunit/phpunit": "^9.0" @@ -3847,27 +3847,27 @@ "type": "github" } ], - "time": "2020-06-26T12:16:22+00:00" + "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "2.2.1", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", - "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/e494dcaeb89d1458c9ccd8c819745245a1669aea", + "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -3899,24 +3899,24 @@ "type": "github" } ], - "time": "2020-07-05T08:31:53+00:00" + "time": "2020-09-28T06:01:38+00:00" }, { "name": "sebastian/version", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", - "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "type": "library", "extra": { @@ -3948,7 +3948,7 @@ "type": "github" } ], - "time": "2020-06-26T12:18:43+00:00" + "time": "2020-09-28T06:39:44+00:00" }, { "name": "symfony/polyfill-ctype", diff --git a/src/Commands/Install/Command.php b/src/Commands/Install/Command.php index ab8247c..244509d 100644 --- a/src/Commands/Install/Command.php +++ b/src/Commands/Install/Command.php @@ -4,6 +4,8 @@ use Exception; use RuntimeException; use BennoThommo\OctoberCli\BaseCommand; +use BennoThommo\OctoberCli\GitHub\Token; +use BennoThommo\OctoberCli\Traits\CheckboxList; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -20,9 +22,20 @@ */ class Command extends BaseCommand { + use CheckboxList; + /** @inheritDoc */ protected static $defaultName = 'install'; + /** @var GitHub\Client GitHub Client instance */ + protected $github = null; + + /** @var string `git` command path */ + protected $gitPath = null; + + /** @var string `composer` command path */ + protected $composerPath = null; + /** @var string Application name */ protected $appName = 'October CMS'; @@ -47,6 +60,15 @@ class Command extends BaseCommand /** @var string Database name (or storage location) */ protected $dbName = 'october'; + /** @var string Administrator account username */ + protected $adminUsername = 'admin'; + + /** @var string Administrator account password */ + protected $adminPassword = null; + + /** @var string Administrator account email address */ + protected $adminEmail = null; + /** * @inheritDoc */ @@ -64,7 +86,8 @@ protected function configure() ' - Easy install: Installs October CMS using the October CMS marketplace.' . PHP_EOL . ' - Composer install: Installs October CMS using Composer.' . PHP_EOL . ' - Contributor install: Installs October CMS using Composer, and sets up the installation in order' . - ' to allow the user to contribute to October CMS.' + ' to allow the user to contribute to October CMS, including setting up a fork in GitHub and' . + ' configuring a local Git repository.' ) // arguments @@ -149,6 +172,24 @@ protected function configure() InputOption::VALUE_REQUIRED, 'Specifies the database password.' ) + ->addOption( + 'admin-user', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the administrator account username.' + ) + ->addOption( + 'admin-pass', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the administrator account password.' + ) + ->addOption( + 'admin-email', + null, + InputOption::VALUE_REQUIRED, + 'Specifies the administrator account email address.' + ) ; } @@ -174,13 +215,35 @@ protected function execute(InputInterface $input, OutputInterface $output) ' marketplace.' . PHP_EOL . ' - Composer install (composer): Installs October CMS using Composer.' . PHP_EOL . ' - Contributor install (contributor): Installs October CMS using Composer, and sets up' . - ' the installation in order to allow the user to contribute to October CMS.' . PHP_EOL, + ' the installation in order to allow the user to contribute to October CMS, including setting up a' . + ' fork in GitHub and configuring a local Git repository.' . PHP_EOL, ['easy', 'composer', 'contributor'], 'easy' ); $mode = $askHelper->ask($input, $output, $question); } + // Check that a GitHub token is available for contributor installation + if ($mode === 'contributor') { + $this->github = new \Github\Client(); + $token = (new Token())->read(); + + $this->github->authenticate($token, null, \Github\Client::AUTH_ACCESS_TOKEN); + } + + // Check that `git` is installed + if ($mode === 'contributor') { + $this->gitPath = $this->getGitPath(); + + echo $this->gitPath; + die(); + } + + // Check that `composer` is installed + if ($mode === 'contributor' || $mode === 'composer') { + $this->composerPath = $this->getComposerPath(); + } + // Check (or clear) the current path $path = $input->getArgument('path') ?? getcwd(); if ($path === '.') { @@ -209,17 +272,17 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getDbSettings($input, $output); $this->getAdminSettings($input, $output); - // switch ($mode) { - // case 'easy': - // $this->doEasyInstall($input, $output, $path); - // break; - // case 'composer': - // $this->doComposerInstall($input, $output, $path); - // break; - // case 'contributor': - // $this->doContributorInstall($input, $output, $path); - // break; - // } + switch ($mode) { + // case 'easy': + // $this->doEasyInstall($input, $output, $path); + // break; + // case 'composer': + // $this->doComposerInstall($input, $output, $path); + // break; + case 'contributor': + $this->doContributorInstall($input, $output, $path); + break; + } print_r([ 'appName' => $this->appName, @@ -330,8 +393,7 @@ protected function getDbSettings(InputInterface $input, OutputInterface $output) $question = new ChoiceQuestion( PHP_EOL . 'Please select the database type you wish to use.' . PHP_EOL . PHP_EOL . - ' - mysql: (default) MySQL / MariaDB' . - ' marketplace.' . PHP_EOL . + ' - mysql: (default) MySQL / MariaDB' . PHP_EOL . ' - pgsql: PostgreSQL.' . PHP_EOL . ' - sqlite: SQLite' . PHP_EOL . ' - sqlsrv: Microsoft SQL Server' . PHP_EOL, @@ -423,14 +485,83 @@ protected function getSqlServerSettings(InputInterface $input, OutputInterface $ $this->dbPass = $input->getOption('db-pass') ?? $this->prompt('SQL Server password?', $this->dbPass, true); } - protected function runCommand(InputInterface $input, OutputInterface $output, string $command): Process + protected function getAdminSettings(InputInterface $input, OutputInterface $output) + { + $this->info('Determine administrator account settings', OutputInterface::VERBOSITY_VERBOSE); + + // Admin username + $this->adminUsername = $input->getOption('admin-user') ?? $this->prompt( + 'Admin username?', + $this->adminUsername + ); + + // Admin password + $this->adminPassword = $input->getOption('admin-pass') ?? $this->prompt( + 'Admin password?', + $this->adminPassword, + true + ); + + // Admin email + $this->adminEmail = $input->getOption('admin-email') ?? $this->prompt( + 'Admin email address?', + $this->adminEmail + ); + } + + protected function doContributorInstall(InputInterface $input, OutputInterface $output, string $path) { - if ($input->getOption('no-ansi')) { - $command .= ' --no-ansi'; + $this->line(); + + // Add a slight pause to indicate installation + usleep(650000); + + $this->info('Installing October CMS...'); + + // Set up fork + $this->doCheck('Fork October CMS repository'); + + // Check for the presence of a fork, and create a fork if not available + $ownedRepos = $this->github->currentUser()->repositories(); + $found = false; + $repository = null; + + foreach ($ownedRepos as $repo) { + if ($repo['name'] === 'october') { + $found = true; + $repository = $repo; + break; + } } - if ($input->getOption('quiet')) { - $command .= ' --quiet'; + if (!$found) { + try { + $repository = $this->github->api('repo')->forks()->create('octobercms', 'october'); + $this->checkSuccessful('October CMS repository forked to ' . $repository['html_url'] . '.'); + } catch (Throwable $e) { + $this->checkFailed('Unable to fork repository.', $e->getMessage()); + } + } else { + $this->checkSuccessful('Forked repository already available at ' . $repository['html_url'] . '.'); + } + + // Install + } + + protected function runCommand( + InputInterface $input = null, + OutputInterface $output = null, + string $command, + bool $return = false + ) { + if (isset($input)) { + if ($input->getOption('no-ansi')) { + $command .= ' --no-ansi'; + } + + if ($input->getOption('quiet')) { + $command .= ' --quiet'; + } } $process = Process::fromShellCommandline($command, null, null, null, null); @@ -443,10 +574,48 @@ protected function runCommand(InputInterface $input, OutputInterface $output, st } } - $process->run(function ($type, $line) use ($output) { - $output->write(' ' . $line); - }); + if ($return) { + $returned = []; + $process->run(function ($type, $line) use ($returned) { + $returned[] = $line; + }); + + return implode(PHP_EOL, $returned); + } else { + if (!isset($output)) { + throw new Exception('You must provide an output interface.'); + } + + $process->run(function ($type, $line) use ($output) { + $output->write(' ' . $line); + }); + + return $process; + } + } + + protected function getGitPath() + { + if (PHP_OS_FAMILY == 'Windows') { + $command = 'where.exe git.exe'; + } else { + $command = 'which git 2>&1'; + } + + $return = $this->runCommand(null, null, $command, true); + + if (empty($return)) { + throw new Exception('Unable to find git binary. Please ensure the `git` command is installed.'); + } + + if (strpos($return, PHP_EOL) !== false) { + $lines = array_filter(explode(PHP_EOL, $return), function ($item) { + return !empty($item); + }); + } else { + $lines = [$return]; + } - return $process; + return $lines[0]; } } From 1a6d377561dabd3825c4508a1260e65e2ac8acc0 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 9 Mar 2021 08:53:40 +0800 Subject: [PATCH 5/7] October -> Winter --- src/Commands/Install/Command.php | 64 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Commands/Install/Command.php b/src/Commands/Install/Command.php index 244509d..28c68fb 100644 --- a/src/Commands/Install/Command.php +++ b/src/Commands/Install/Command.php @@ -1,11 +1,11 @@ -setDescription('Installs October CMS.') + ->setDescription('Installs Winter CMS.') // the full command description shown when running the command with // the "--help" option ->setHelp( - 'This command allows you to install October CMS into a specified path.' . PHP_EOL . PHP_EOL . + 'This command allows you to install Winter CMS into a specified path.' . PHP_EOL . PHP_EOL . 'Three types of installation are available:' . PHP_EOL . - ' - Easy install: Installs October CMS using the October CMS marketplace.' . PHP_EOL . - ' - Composer install: Installs October CMS using Composer.' . PHP_EOL . - ' - Contributor install: Installs October CMS using Composer, and sets up the installation in order' . - ' to allow the user to contribute to October CMS, including setting up a fork in GitHub and' . + ' - Easy install: Installs Winter CMS using the Winter CMS marketplace.' . PHP_EOL . + ' - Composer install: Installs Winter CMS using Composer.' . PHP_EOL . + ' - Contributor install: Installs Winter CMS using Composer, and sets up the installation in order' . + ' to allow the user to contribute to Winter CMS, including setting up a fork in GitHub and' . ' configuring a local Git repository.' ) @@ -94,7 +94,7 @@ protected function configure() ->addArgument( 'path', InputArgument::OPTIONAL, - 'The path to the October CMS project.' + 'The path to the Winter CMS project.' ) // options @@ -102,39 +102,39 @@ protected function configure() 'composer', 'c', InputOption::VALUE_NONE, - 'Installs October CMS using Composer.' + 'Installs Winter CMS using Composer.' ) ->addOption( 'contributor', null, InputOption::VALUE_NONE, - 'Installs October CMS using Composer, and sets up the installation in order' . - ' to allow the user to contribute to October CMS.' + 'Installs Winter CMS using Composer, and sets up the installation in order' . + ' to allow the user to contribute to Winter CMS.' ) ->addOption( 'easy', 'e', InputOption::VALUE_NONE, - 'Installs October CMS using the October CMS marketplace.' + 'Installs Winter CMS using the Winter CMS marketplace.' ) ->addOption( 'force', 'f', InputOption::VALUE_NONE, - 'Forces the installation of October CMS (will delete any files within the path specified).' + 'Forces the installation of Winter CMS (will delete any files within the path specified).' ) // settings options ->addOption( 'app-name', null, InputOption::VALUE_REQUIRED, - 'Specifies the name of the October CMS project.' + 'Specifies the name of the Winter CMS project.' ) ->addOption( 'app-url', null, InputOption::VALUE_REQUIRED, - 'Specifies the URL of the October CMS project.' + 'Specifies the URL of the Winter CMS project.' ) ->addOption( 'db-type', @@ -211,11 +211,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $question = new ChoiceQuestion( PHP_EOL . 'Please select the installation type.' . PHP_EOL . PHP_EOL . - ' - Easy install (easy): (default) Installs October CMS using the October CMS' . + ' - Easy install (easy): (default) Installs Winter CMS using the Winter CMS' . ' marketplace.' . PHP_EOL . - ' - Composer install (composer): Installs October CMS using Composer.' . PHP_EOL . - ' - Contributor install (contributor): Installs October CMS using Composer, and sets up' . - ' the installation in order to allow the user to contribute to October CMS, including setting up a' . + ' - Composer install (composer): Installs Winter CMS using Composer.' . PHP_EOL . + ' - Contributor install (contributor): Installs Winter CMS using Composer, and sets up' . + ' the installation in order to allow the user to contribute to Winter CMS, including setting up a' . ' fork in GitHub and configuring a local Git repository.' . PHP_EOL, ['easy', 'composer', 'contributor'], 'easy' @@ -323,7 +323,7 @@ protected function checkPathIsEmpty(string $path): void if ($item->isFile() || $item->isLink() || $item->isDir()) { $message = 'Path "' . $path . '" is not empty.'; if ($path === getcwd()) { - $message .= ' Please clear out the current directory to install October CMS here.'; + $message .= ' Please clear out the current directory to install Winter CMS here.'; } else { $message .= 'Use the --force option to ignore this.'; } @@ -333,7 +333,7 @@ protected function checkPathIsEmpty(string $path): void } if (is_file($path)) { - throw new Exception('Path "' . $path . '" is a file. You must install October CMS in a directory.'); + throw new Exception('Path "' . $path . '" is a file. You must install Winter CMS in a directory.'); } } @@ -352,7 +352,7 @@ protected function clearPath(InputInterface $input, OutputInterface $output, str return; } if (is_file($path)) { - throw new Exception('Path "' . $path . '" is a file. You must install October CMS in a directory.'); + throw new Exception('Path "' . $path . '" is a file. You must install Winter CMS in a directory.'); } // Remove the path completely @@ -516,10 +516,10 @@ protected function doContributorInstall(InputInterface $input, OutputInterface $ // Add a slight pause to indicate installation usleep(650000); - $this->info('Installing October CMS...'); + $this->info('Installing Winter CMS...'); // Set up fork - $this->doCheck('Fork October CMS repository'); + $this->doCheck('Fork Winter CMS repository'); // Check for the presence of a fork, and create a fork if not available $ownedRepos = $this->github->currentUser()->repositories(); @@ -527,7 +527,7 @@ protected function doContributorInstall(InputInterface $input, OutputInterface $ $repository = null; foreach ($ownedRepos as $repo) { - if ($repo['name'] === 'october') { + if ($repo['name'] === 'winter') { $found = true; $repository = $repo; break; @@ -536,8 +536,8 @@ protected function doContributorInstall(InputInterface $input, OutputInterface $ if (!$found) { try { - $repository = $this->github->api('repo')->forks()->create('octobercms', 'october'); - $this->checkSuccessful('October CMS repository forked to ' . $repository['html_url'] . '.'); + $repository = $this->github->api('repo')->forks()->create('wintercms', 'winter'); + $this->checkSuccessful('Winter CMS repository forked to ' . $repository['html_url'] . '.'); } catch (Throwable $e) { $this->checkFailed('Unable to fork repository.', $e->getMessage()); } From 5ed7132502de2eca7644765fc3875d20bf37e8c3 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 9 Mar 2021 15:38:35 +0800 Subject: [PATCH 6/7] Fix PHPCS warning --- src/Filesystem/PathResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Filesystem/PathResolver.php b/src/Filesystem/PathResolver.php index d2a5e95..ae62e1d 100644 --- a/src/Filesystem/PathResolver.php +++ b/src/Filesystem/PathResolver.php @@ -78,8 +78,8 @@ public static function resolve($path) $drive = array_shift($resolvedSegments) ?: null; continue; } elseif (is_file($currentPath) && $i < (count($pathSegments) - 1)) { - // If we've hit a file and we're trying to relatively traverse the path further, we need to fail at this - // point. + // If we've hit a file and we're trying to relatively traverse the path further, we need to fail + // at this point. return false; } } catch (Throwable $e) { From f550858b8d163a5e445deafd8f5d2b389171f786 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 9 Mar 2021 18:03:53 +0800 Subject: [PATCH 7/7] Further WIP --- index.php | 2 +- src/Commands/Install/Command.php | 80 ++++++++++++++++++++++++-------- src/GitHub/Token.php | 2 +- 3 files changed, 63 insertions(+), 21 deletions(-) diff --git a/index.php b/index.php index 2125dcd..68c296a 100644 --- a/index.php +++ b/index.php @@ -7,7 +7,7 @@ } // Load dependencies -require __DIR__.'/vendor/autoload.php'; +require __DIR__ . '/vendor/autoload.php'; use Winter\Cli\Application; diff --git a/src/Commands/Install/Command.php b/src/Commands/Install/Command.php index 28c68fb..264a720 100644 --- a/src/Commands/Install/Command.php +++ b/src/Commands/Install/Command.php @@ -25,7 +25,7 @@ class Command extends BaseCommand use CheckboxList; /** @inheritDoc */ - protected static $defaultName = 'install'; + protected static $defaultName = 'install:run'; /** @var GitHub\Client GitHub Client instance */ protected $github = null; @@ -75,6 +75,8 @@ class Command extends BaseCommand protected function configure() { $this + // aliases + ->setAliases(['install']) // the short description shown while running "php bin/console list" ->setDescription('Installs Winter CMS.') @@ -233,15 +235,20 @@ protected function execute(InputInterface $input, OutputInterface $output) // Check that `git` is installed if ($mode === 'contributor') { - $this->gitPath = $this->getGitPath(); - - echo $this->gitPath; - die(); + try { + $this->getGitPath(); + } catch (Exception $e) { + throw new Exception('"git" command is required to install the contributor version of Winter CMS.'); + } } // Check that `composer` is installed if ($mode === 'contributor' || $mode === 'composer') { - $this->composerPath = $this->getComposerPath(); + try { + $this->getComposerPath(); + } catch (Exception $e) { + throw new Exception('"composer" command is required to install the contributor version of Winter CMS.'); + } } // Check (or clear) the current path @@ -283,18 +290,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->doContributorInstall($input, $output, $path); break; } - - print_r([ - 'appName' => $this->appName, - 'appUrl' => $this->appUrl, - 'dbType' => $this->dbType, - 'dbHost' => $this->dbHost, - 'dbPort' => $this->dbPort, - 'dbName' => $this->dbName, - 'dbUser' => $this->dbUser, - 'dbPass' => $this->dbPass, - ]); - die(); } /** @@ -596,6 +591,10 @@ protected function runCommand( protected function getGitPath() { + if (!empty($this->gitPath)) { + return $this->gitPath; + } + if (PHP_OS_FAMILY == 'Windows') { $command = 'where.exe git.exe'; } else { @@ -616,6 +615,49 @@ protected function getGitPath() $lines = [$return]; } - return $lines[0]; + return $this->gitPath = $lines[0]; + } + + protected function getComposerPath() + { + if (!empty($this->composerPath)) { + return $this->composerPath; + } + + if (PHP_OS_FAMILY == 'Windows') { + $command = 'where.exe composer.exe'; + } else { + $command = 'which composer 2>&1'; + } + + $return = $this->runCommand(null, null, $command, true); + + if (empty($return)) { + // Try to find a local install of Composer + if ( + file_exists(getcwd() . DIRECTORY_SEPARATOR . 'composer.phar') + && is_executable(getcwd() . DIRECTORY_SEPARATOR . 'composer.phar') + ) { + return $this->composerPath = getcwd() . DIRECTORY_SEPARATOR . 'composer.phar'; + } + if ( + file_exists(getcwd() . DIRECTORY_SEPARATOR . 'composer') + && is_executable(getcwd() . DIRECTORY_SEPARATOR . 'composer') + ) { + return $this->composerPath = getcwd() . DIRECTORY_SEPARATOR . 'composer'; + } + + throw new Exception('Unable to find Composer binary. Please ensure the `composer` command is installed.'); + } + + if (strpos($return, PHP_EOL) !== false) { + $lines = array_filter(explode(PHP_EOL, $return), function ($item) { + return !empty($item); + }); + } else { + $lines = [$return]; + } + + return $this->gitPath = $lines[0]; } } diff --git a/src/GitHub/Token.php b/src/GitHub/Token.php index a019a79..ab7a600 100644 --- a/src/GitHub/Token.php +++ b/src/GitHub/Token.php @@ -64,6 +64,6 @@ public function read(): string ); } - return $this->token; + return $this->token = $token; } }