Skip to content

Commit c61fa97

Browse files
committed
Composer 2
1 parent 9f13a21 commit c61fa97

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed

composer.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@
1212
"extra": {
1313
"class": "DrupalComposer\\Composer\\DrupalInfo",
1414
"branch-alias": {
15-
"dev-master": "1.0.x-dev"
15+
"dev-master": "2.0.x-dev"
1616
}
1717
},
1818
"require": {
19-
"composer-plugin-api": "^1.1"
19+
"composer-plugin-api": "^2.0"
2020
},
2121
"require-dev": {
22-
"composer/composer": "~1.0",
23-
"jakub-onderka/php-parallel-lint": "~0.8",
24-
"mikey179/vfsstream": "~1.2",
25-
"phpunit/phpunit": "~5.6",
26-
"squizlabs/php_codesniffer": "~2.0"
22+
"composer/composer": "^2.0",
23+
"php-parallel-lint/php-parallel-lint": "^1.2",
24+
"mikey179/vfsstream": "^1.6",
25+
"phpunit/phpunit": "^9",
26+
"squizlabs/php_codesniffer": "^3.5"
2727
},
2828
"autoload": {
29-
"psr-4": {"DrupalComposer\\Composer\\": "src"}
29+
"psr-4": {
30+
"DrupalComposer\\Composer\\": "src"
31+
}
3032
},
3133
"autoload-dev": {
32-
"psr-4": {"DrupalComposer\\Composer\\Tests\\": "tests"}
34+
"psr-4": {
35+
"DrupalComposer\\Composer\\Tests\\": "tests"
36+
}
3337
},
3438
"scripts": {
3539
"test:unit": "phpunit --log-junit=reports/unitreport.xml --coverage-text --coverage-html=reports/coverage --coverage-clover=reports/coverage.xml",

src/DrupalInfo.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@ public function activate(Composer $composer, IOInterface $io)
6161
}
6262
}
6363

64+
/**
65+
* {@inheritdoc}
66+
*/
67+
public function deactivate(Composer $composer, IOInterface $io)
68+
{
69+
70+
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*/
75+
public function uninstall(Composer $composer, IOInterface $io)
76+
{
77+
78+
}
79+
6480
/**
6581
* {@inheritdoc}
6682
*/
@@ -163,7 +179,7 @@ protected function doWriteInfoFiles(PackageInterface $package)
163179
);
164180
} elseif ($this->io->isVerbose()) {
165181
$this->io->write(
166-
'<info>No info files found for ' .$package->getPrettyName() . '</info>'
182+
'<info>No info files found for ' . $package->getPrettyName() . '</info>'
167183
);
168184
}
169185
}
@@ -178,7 +194,7 @@ protected function doRollback(PackageInterface $package)
178194
$writer->rollback();
179195
} elseif ($this->io->isVerbose()) {
180196
$this->io->write(
181-
'<info>No info files found for ' .$package->getPrettyName() . '</info>'
197+
'<info>No info files found for ' . $package->getPrettyName() . '</info>'
182198
);
183199
}
184200
}
@@ -200,7 +216,7 @@ protected function getWriter(PackageInterface $package)
200216
/**
201217
* Find specific version info for a given package.
202218
*
203-
* @param PackageInterface $package
219+
* @param PackageInterface $package
204220
* @return string
205221
*/
206222
protected function findVersion(PackageInterface $package)
@@ -219,7 +235,7 @@ protected function findVersion(PackageInterface $package)
219235
/**
220236
* Find a timestamp that the release is from in the package.
221237
*
222-
* @param PackageInterface $package
238+
* @param PackageInterface $package
223239
* @return string
224240
* Unix timestamp.
225241
*/
@@ -283,7 +299,7 @@ protected function findPackage(PackageInterface $package)
283299
/**
284300
* Determine if this package should be processed.
285301
*
286-
* @param PackageInterface $package
302+
* @param PackageInterface $package
287303
* @return bool
288304
*/
289305
protected function processPackage(PackageInterface $package)
@@ -294,7 +310,7 @@ protected function processPackage(PackageInterface $package)
294310
/**
295311
* Gather the package from the given operation.
296312
*
297-
* @param OperationInterface $operation
313+
* @param OperationInterface $operation
298314
* @return \Composer\Package\PackageInterface
299315
* @throws \Exception
300316
*/
@@ -313,4 +329,5 @@ protected function getPackageFromOperation(OperationInterface $operation)
313329
}
314330
return $package;
315331
}
332+
316333
}

src/Writer/Drupal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Drupal implements WriterInterface
1010
/**
1111
* Pattern to indicate a file already has version info.
1212
*/
13-
const VERSION_EXISTS_PATTERN = '#version:.*[\d+].*#';
13+
const VERSION_EXISTS_PATTERN = '#(version:.*[\d+].*|version: VERSION)#';
1414

1515
/**
1616
* Pattern to indicate a file has core_version_requirement.

src/Writer/WriterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public function set(array $paths);
1717
/**
1818
* Rewrites the .info files with the provided version and timestamp.
1919
*
20-
* @param string $version
20+
* @param string $version
2121
* Version information to write out.
22-
* @param string $timestamp
22+
* @param string $timestamp
2323
* @return
2424
*/
2525
public function rewrite($version, $timestamp, $core = null, $project = null);

0 commit comments

Comments
 (0)