Skip to content

Commit f8eade7

Browse files
authored
Merge pull request #15 from zaporylie/core-recommended-support
Add support for new drupal/core-recommended subtree split
2 parents c381f68 + 5287d46 commit f8eade7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ env:
1616
- RELEASE=stable COMPOSER_CHANNEL=snapshot
1717

1818
matrix:
19+
allow_failures:
20+
# 5.6 is no longer supported by drupal-composer/drupal-project
21+
- php: 5.6
22+
env: RELEASE=stable COMPOSER_CHANNEL=stable
1923
exclude:
2024
- php: 5.6
2125
env: RELEASE=dev COMPOSER_CHANNEL=stable

src/Plugin.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ public function activate(Composer $composer, IOInterface $io)
1919
// Set default version constraints based on the composer requirements.
2020
$extra = $composer->getPackage()->getExtra();
2121
$packages = $composer->getPackage()->getRequires();
22-
if (!isset($extra['composer-drupal-optimizations']['require']) && isset($packages['drupal/core'])) {
23-
$coreConstraint = $packages['drupal/core']->getConstraint();
24-
$extra['composer-drupal-optimizations']['require'] = static::getDefaultRequire($coreConstraint);
25-
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {
26-
$io->write('Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project\'s composer.json content.');
22+
if (!isset($extra['composer-drupal-optimizations']['require'])) {
23+
$package = isset($packages['drupal/core']) ? $packages['drupal/core'] : (isset($packages['drupal/core-recommended']) ? $packages['drupal/core-recommended'] : null);
24+
if (isset($package)) {
25+
$coreConstraint = $package->getConstraint();
26+
$extra['composer-drupal-optimizations']['require'] = static::getDefaultRequire($coreConstraint);
27+
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {
28+
$io->write('Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project\'s composer.json content.');
29+
}
2730
}
2831
}
2932
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {

0 commit comments

Comments
 (0)