diff --git a/.travis.yml b/.travis.yml index 200f3d6f..6519c955 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,24 +10,14 @@ matrix: include: - php: 5.5 env: COMPOSER_VERSION="" - - php: 5.5 - env: COMPOSER_VERSION="1.2.x-dev" - php: 5.6 env: COMPOSER_VERSION="" - - php: 5.6 - env: COMPOSER_VERSION="1.2.x-dev" - php: 7.0 env: COMPOSER_VERSION="" - - php: 7.0 - env: COMPOSER_VERSION="1.2.x-dev" - php: hhvm env: COMPOSER_VERSION="" - - php: hhvm - env: COMPOSER_VERSION="1.2.x-dev" - php: nightly env: COMPOSER_VERSION="" - - php: nightly - env: COMPOSER_VERSION="1.2.x-dev" allow_failures: - php: nightly diff --git a/Tests/Fixtures/Repository/Vcs/MockVcsDriver.php b/Tests/Fixtures/Repository/Vcs/MockVcsDriver.php index 5f15dd94..1b366c59 100644 --- a/Tests/Fixtures/Repository/Vcs/MockVcsDriver.php +++ b/Tests/Fixtures/Repository/Vcs/MockVcsDriver.php @@ -127,4 +127,19 @@ protected function getContents() { return $this->contents; } + + /** + * {@inheritdoc} + */ + public function getFileContent($file, $identifier) + { + } + + /** + * {@inheritdoc} + */ + public function getChangeDate($identifier) + { + return new \DateTime(); + } } diff --git a/Tests/Util/PerforceTest.php b/Tests/Util/PerforceTest.php index 74f796e6..34b4deb1 100644 --- a/Tests/Util/PerforceTest.php +++ b/Tests/Util/PerforceTest.php @@ -241,7 +241,7 @@ function ($command, &$output) { $result = $this->perforce->getComposerInformation('//depot/branch@0.0.1'); - $this->assertSame('', $result); + $this->assertNull($result); } public function testGetComposerInformationWithLabelWithStreamWithNoChange() @@ -263,7 +263,7 @@ function ($command, &$output) { $result = $this->perforce->getComposerInformation('//depot/branch@0.0.1'); - $this->assertSame('', $result); + $this->assertNull($result); } public function testCheckServerExists() diff --git a/Util/Perforce.php b/Util/Perforce.php index b60486f6..3d5b8bd8 100644 --- a/Util/Perforce.php +++ b/Util/Perforce.php @@ -44,45 +44,11 @@ public function initialize($repoConfig) */ public function getComposerInformation($identifier) { - $index = strpos($identifier, '@'); + $composerFileContent = $this->getFileContent($this->filename, $identifier); - if ($index === false) { - $composerJson = $identifier.'/'.$this->filename; - - return $this->getComposerInformationFromPath($composerJson); - } - - return $this->getComposerInformationFromLabel($identifier, $index); - } - - /** - * @param string $identifier - * @param string $index - * - * @return array|string - */ - public function getComposerInformationFromLabel($identifier, $index) - { - $composerJsonPath = substr($identifier, 0, $index).'/'.$this->filename.substr($identifier, $index); - $command = $this->generateP4Command(' files '.$composerJsonPath, false); - $this->executeCommand($command); - $result = $this->commandResult; - $index2 = strpos($result, 'no such file(s).'); - - if ($index2 === false) { - $index3 = strpos($result, 'change'); - - if (!($index3 === false)) { - $phrase = trim(substr($result, $index3)); - $fields = explode(' ', $phrase); - $id = $fields[1]; - $composerJson = substr($identifier, 0, $index).'/'.$this->filename.'@'.$id; - - return $this->getComposerInformationFromPath($composerJson); - } - } - - return ''; + return !$composerFileContent + ? null + : json_decode($composerFileContent, true); } /** diff --git a/composer.json b/composer.json index 775717cb..16649116 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "composer-plugin-api": "^1.0" }, "require-dev": { - "composer/composer": "^1.0.0" + "composer/composer": "^1.3.0" }, "autoload": { "psr-4": { @@ -32,7 +32,7 @@ "extra": { "class": "Fxp\\Composer\\AssetPlugin\\FxpAssetPlugin", "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } } } diff --git a/composer.lock b/composer.lock index a3c7a118..5a2773a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,22 +4,22 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "01c3e6387753a458f15d0ddca74884cd", - "content-hash": "821c9cdf8b245ceea4f38768360e597d", + "hash": "60df0aa4790cfd76581ce50c29ef2a20", + "content-hash": "292c7331343b568bdea4bd5f06a1e96f", "packages": [], "packages-dev": [ { "name": "composer/ca-bundle", - "version": "1.0.4", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "ec21a59414b99501e723b63fd664aa8ead9c5680" + "reference": "a795611394b3c05164fd0eb291b492b39339cba4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/ec21a59414b99501e723b63fd664aa8ead9c5680", - "reference": "ec21a59414b99501e723b63fd664aa8ead9c5680", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/a795611394b3c05164fd0eb291b492b39339cba4", + "reference": "a795611394b3c05164fd0eb291b492b39339cba4", "shasum": "" }, "require": { @@ -64,36 +64,36 @@ "ssl", "tls" ], - "time": "2016-09-04 19:00:06" + "time": "2016-11-02 18:11:27" }, { "name": "composer/composer", - "version": "1.2.1", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "16422c4b1ac4286f7caecf5211136dc073191672" + "reference": "91dbca556764dcece45e1ba3aab14de2deaa9fec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/16422c4b1ac4286f7caecf5211136dc073191672", - "reference": "16422c4b1ac4286f7caecf5211136dc073191672", + "url": "https://api.github.com/repos/composer/composer/zipball/91dbca556764dcece45e1ba3aab14de2deaa9fec", + "reference": "91dbca556764dcece45e1ba3aab14de2deaa9fec", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", "composer/semver": "^1.0", "composer/spdx-licenses": "^1.0", - "justinrainbow/json-schema": "^1.6 || ^2.0", + "justinrainbow/json-schema": "^1.6 || ^2.0 || ^3.0 || ^4.0", "php": "^5.3.2 || ^7.0", "psr/log": "^1.0", "seld/cli-prompt": "^1.0", "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.0", - "symfony/console": "^2.5 || ^3.0", - "symfony/filesystem": "^2.5 || ^3.0", - "symfony/finder": "^2.2 || ^3.0", - "symfony/process": "^2.1 || ^3.0" + "symfony/console": "^2.7 || ^3.0", + "symfony/filesystem": "^2.7 || ^3.0", + "symfony/finder": "^2.7 || ^3.0", + "symfony/process": "^2.7 || ^3.0" }, "require-dev": { "phpunit/phpunit": "^4.5 || ^5.0.5", @@ -110,7 +110,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -141,7 +141,7 @@ "dependency", "package" ], - "time": "2016-09-12 09:27:20" + "time": "2017-01-07 17:08:51" }, { "name": "composer/semver", @@ -268,16 +268,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "2.0.5", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "6b2a33e6a768f96bdc2ead5600af0822eed17d67" + "reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/6b2a33e6a768f96bdc2ead5600af0822eed17d67", - "reference": "6b2a33e6a768f96bdc2ead5600af0822eed17d67", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/d39c56a46b3ebe1f3696479966cd2b9f50aaa24f", + "reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f", "shasum": "" }, "require": { @@ -294,7 +294,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -330,7 +330,7 @@ "json", "schema" ], - "time": "2016-06-02 10:59:52" + "time": "2016-12-22 16:43:46" }, { "name": "psr/log", @@ -429,16 +429,16 @@ }, { "name": "seld/jsonlint", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "e827b5254d3e58c736ea2c5616710983d80b0b70" + "reference": "19495c181d6d53a0a13414154e52817e3b504189" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/e827b5254d3e58c736ea2c5616710983d80b0b70", - "reference": "e827b5254d3e58c736ea2c5616710983d80b0b70", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/19495c181d6d53a0a13414154e52817e3b504189", + "reference": "19495c181d6d53a0a13414154e52817e3b504189", "shasum": "" }, "require": { @@ -471,7 +471,7 @@ "parser", "validator" ], - "time": "2016-09-14 15:17:56" + "time": "2016-11-14 17:59:58" }, { "name": "seld/phar-utils", @@ -519,16 +519,16 @@ }, { "name": "symfony/console", - "version": "v3.1.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0" + "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6cb0872fb57b38b3b09ff213c21ed693956b9eb0", - "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0", + "url": "https://api.github.com/repos/symfony/console/zipball/4f9e449e76996adf310498a8ca955c6deebe29dd", + "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd", "shasum": "" }, "require": { @@ -539,17 +539,19 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -576,20 +578,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:11:12" + "time": "2017-01-08 20:47:33" }, { "name": "symfony/debug", - "version": "v3.1.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8" + "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", - "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", + "url": "https://api.github.com/repos/symfony/debug/zipball/810ba5c1c5352a4ddb15d4719e8936751dff0b05", + "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05", "shasum": "" }, "require": { @@ -606,7 +608,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -633,20 +635,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-09-06 11:02:40" + "time": "2017-01-02 20:32:22" }, { "name": "symfony/filesystem", - "version": "v3.1.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5" + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", - "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "shasum": "" }, "require": { @@ -655,7 +657,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -682,20 +684,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-09-14 00:18:46" + "time": "2017-01-08 20:47:33" }, { "name": "symfony/finder", - "version": "v3.1.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "205b5ffbb518a98ba2ae60a52656c4a31ab00c6f" + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/205b5ffbb518a98ba2ae60a52656c4a31ab00c6f", - "reference": "205b5ffbb518a98ba2ae60a52656c4a31ab00c6f", + "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6", + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6", "shasum": "" }, "require": { @@ -704,7 +706,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -731,20 +733,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:11:12" + "time": "2017-01-02 20:32:22" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -756,7 +758,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -790,20 +792,20 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/process", - "version": "v3.1.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", + "url": "https://api.github.com/repos/symfony/process/zipball/350e810019fc52dd06ae844b6a6d382f8a0e8893", + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893", "shasum": "" }, "require": { @@ -812,7 +814,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -839,7 +841,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-09-29 14:13:09" + "time": "2017-01-02 20:32:22" } ], "aliases": [],