1
0
Fork 0

Allowed only * wildcard

pull/1419/head
Aurélien Thieriot 2012-12-13 14:06:06 +00:00
parent 159badb06b
commit e264282ac7
3 changed files with 12 additions and 7 deletions

View File

@ -96,9 +96,9 @@ If you just want to update a few packages and not all, you can list them as such
$ php composer.phar update vendor/package vendor/package2
You can also use a Regular expression pattern to update a bunch of packages at once:
You can also use wildcards to update a bunch of packages at once:
$ php composer.phar update vendor.*
$ php composer.phar update vendor/*
### Options

View File

@ -625,7 +625,9 @@ class Installer
}
foreach($this->updateWhitelist as $whiteListedPattern => $void) {
if(preg_match("#^".$whiteListedPattern."$#i", $package->getName())) {
$cleanedWhiteListedPattern = str_replace('\*', '.*', preg_quote($whiteListedPattern));
if(preg_match("#^".$cleanedWhiteListedPattern."$#i", $package->getName())) {
return true;
}
}

View File

@ -12,7 +12,8 @@ Update with a package whitelist only updates those corresponding to the pattern
{ "name": "notexact/TestPackage", "version": "2.0" },
{ "name": "all/Package1", "version": "2.0" },
{ "name": "all/Package2", "version": "2.0" },
{ "name": "another/another", "version": "2.0" }
{ "name": "another/another", "version": "2.0" },
{ "name": "no/regexp", "version": "2.0" }
]
}
],
@ -23,7 +24,8 @@ Update with a package whitelist only updates those corresponding to the pattern
"notexact/TestPackage": "*.*",
"all/Package1": "*.*",
"all/Package2": "*.*",
"another/another": "*.*"
"another/another": "*.*",
"no/regexp": "*.*"
}
}
--INSTALLED--
@ -34,10 +36,11 @@ Update with a package whitelist only updates those corresponding to the pattern
{ "name": "notexact/TestPackage", "version": "1.0" },
{ "name": "all/Package1", "version": "1.0" },
{ "name": "all/Package2", "version": "1.0" },
{ "name": "another/another", "version": "1.0" }
{ "name": "another/another", "version": "1.0" },
{ "name": "no/regexp", "version": "1.0" }
]
--RUN--
update vendor/Test.* exact/Test-Package notexact/Test all.*
update vendor/Test* exact/Test-Package notexact/Test all/* no/reg?xp
--EXPECT--
Updating vendor/Test-Package (1.0) to vendor/Test-Package (2.0)
Updating exact/Test-Package (1.0) to exact/Test-Package (2.0)