Skip to content

Commit 44c6a3b

Browse files
committed
Merge remote-tracking branch 'origin/master' into MAGETWO-51439-git-repo-in-composer
2 parents 96c037c + ac0891c commit 44c6a3b

10 files changed

+46
-17
lines changed

LICENSE_AFL.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Licensed under the Academic Free License version 3.0
4545

4646
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
4747

48-
16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
48+
16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "magento/composer",
33
"description": "Magento composer library helps to instantiate Composer application and run composer commands.",
44
"type": "library",
5-
"version": "1.0.0",
5+
"version": "1.0.3",
66
"license": [
77
"OSL-3.0",
88
"AFL-3.0"
99
],
1010
"require": {
11-
"php": "~5.5.0|~5.6.0",
12-
"composer/composer": "1.0.0-alpha10",
11+
"php": "~5.5.0|~5.6.0|~7.0.0",
12+
"composer/composer": "1.0.0-beta1",
1313
"symfony/console": "~2.3 <2.7"
1414
},
1515
"require-dev": {

src/ConsoleArrayInputFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

src/InfoCommand.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

@@ -28,6 +28,12 @@ class InfoCommand
2828
*/
2929
const NAME = 'name';
3030

31+
/**
32+
* New versions
33+
*/
34+
const NEW_VERSIONS = 'new_versions';
35+
36+
3137
/**
3238
* @var MagentoComposerApplication
3339
*/
@@ -52,10 +58,12 @@ public function __construct(MagentoComposerApplication $magentoComposerApplicati
5258
*/
5359
public function run($package, $installed = false)
5460
{
61+
$showAllPackages = !$installed;
5562
$commandParameters = [
5663
'command' => 'info',
5764
'package' => $package,
58-
'-i' => $installed
65+
'-i' => $installed,
66+
'--all' => $showAllPackages,
5967
];
6068

6169
try {
@@ -64,8 +72,8 @@ public function run($package, $installed = false)
6472
return false;
6573
}
6674

67-
$rawLines = explode(PHP_EOL, $output);
68-
$result = [];
75+
$rawLines = explode("\n", str_replace("\r\n", "\n", $output));
76+
6977
foreach ($rawLines as $line) {
7078
$chunk = explode(':', $line);
7179
if (count($chunk) === 2) {
@@ -91,10 +99,11 @@ public function run($package, $installed = false)
9199
private function extractVersions($packageInfo)
92100
{
93101
$versions = explode(', ', $packageInfo[self::VERSIONS]);
102+
$packageInfo[self::NEW_VERSIONS] = [];
103+
$packageInfo[self::AVAILABLE_VERSIONS] = [];
94104

95105
if (count($versions) === 1) {
96106
$packageInfo[self::CURRENT_VERSION] = str_replace('* ', '', $packageInfo[self::VERSIONS]);
97-
$packageInfo[self::AVAILABLE_VERSIONS] = [];
98107
} else {
99108
$currentVersion = array_values(preg_grep("/^\*.*/", $versions));
100109
if ($currentVersion) {
@@ -106,6 +115,18 @@ private function extractVersions($packageInfo)
106115
$packageInfo[self::AVAILABLE_VERSIONS] = array_values(preg_grep("/^\*.*/", $versions, PREG_GREP_INVERT));
107116
}
108117

118+
if (count($packageInfo[self::AVAILABLE_VERSIONS]) > 0) {
119+
if ($packageInfo[self::CURRENT_VERSION]) {
120+
foreach ($packageInfo[self::AVAILABLE_VERSIONS] as $version) {
121+
if (version_compare($packageInfo[self::CURRENT_VERSION], $version, '<')) {
122+
$packageInfo[self::NEW_VERSIONS][] = $version;
123+
}
124+
}
125+
} else {
126+
$packageInfo[self::NEW_VERSIONS] = $packageInfo[self::AVAILABLE_VERSIONS];
127+
}
128+
}
129+
109130
return $packageInfo;
110131
}
111132
}

src/MagentoComposerApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

src/RequireUpdateDryRunCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

tests/Composer/ConsoleArrayInputFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

tests/Composer/InfoCommandTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

@@ -61,7 +61,8 @@ public function testRunInstalled()
6161
'type' => 'library',
6262
'names' => '3rdp/a',
6363
'current_version' => '1.0.0',
64-
'available_versions' => []
64+
'available_versions' => [],
65+
'new_versions' => []
6566
],
6667
$result
6768
);
@@ -97,6 +98,10 @@ public function getCommandOutputDataProvider()
9798
'available_versions' => [
9899
'1.0.0',
99100
'1.1.0'
101+
],
102+
'new_versions' => [
103+
'1.0.0',
104+
'1.1.0'
100105
]
101106
]
102107
],
@@ -123,6 +128,9 @@ public function getCommandOutputDataProvider()
123128
'1.0.0',
124129
'1.1.0',
125130
'1.2.0'
131+
],
132+
'new_versions' => [
133+
'1.2.0'
126134
]
127135
]
128136
],

tests/Composer/MagentoComposerApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

tests/Composer/RequireUpdateDryRunCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2015 Magento. All rights reserved.
3+
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

0 commit comments

Comments
 (0)