Skip to content

Commit

Permalink
Enhancement: Pass through select options to UpdateCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 2, 2023
1 parent 48f0547 commit 190f2d0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi"

- name: "Run composer-normalize.phar with argument and options"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi --dry-run composer.json"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --dry-run --no-ansi composer.json"

dependency-analysis:
name: "Dependency Analysis"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ For a full diff see [`2.30.2...main`][2.30.2...main].

- Updated `schema.json` ([#1070]), by [@ergebnis-bot]
- Required `ergebnis/json-normalizer:^4.1.0` ([#1095]), by [@dependabot]
- Started passing through `--no-ansi` option to `UpdateCommand` ([#827]), by [@localheinz]

### Fixed

Expand Down Expand Up @@ -1006,6 +1007,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[#807]: https://github.com/ergebnis/composer-normalize/pull/807
[#816]: https://github.com/ergebnis/composer-normalize/pull/816
[#825]: https://github.com/ergebnis/composer-normalize/pull/825
[#827]: https://github.com/ergebnis/composer-normalize/pull/827
[#829]: https://github.com/ergebnis/composer-normalize/pull/829
[#842]: https://github.com/ergebnis/composer-normalize/pull/842
[#845]: https://github.com/ergebnis/composer-normalize/pull/845
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ phar: phive vendor ## Builds a phar with humbug/box
.phive/box info .build/phar/composer-normalize.phar
.build/phar/composer-normalize.phar
.build/phar/composer-normalize.phar --dry-run composer.json
.build/phar/composer-normalize.phar --dry-run --no-ansi composer.json

.PHONY: phive
phive: .phive ## Installs dependencies with phive
Expand Down
4 changes: 2 additions & 2 deletions infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"logs": {
"text": ".build/infection/infection-log.txt"
},
"minCoveredMsi": 87,
"minMsi": 72,
"minCoveredMsi": 86,
"minMsi": 67,
"phpUnit": {
"configDir": "test"
},
Expand Down
28 changes: 19 additions & 9 deletions src/Command/NormalizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ public function normalize(Json $json): Json

return self::updateLockerInWorkingDirectory(
$application,
$input,
$output,
\dirname($composerFile),
);
Expand Down Expand Up @@ -513,19 +514,28 @@ private static function formatDiff(string $diff): string
*/
private static function updateLockerInWorkingDirectory(
Console\Application $application,
Console\Input\InputInterface $input,
Console\Output\OutputInterface $output,
string $workingDirectory,
): int {
$parameters = [
'command' => 'update',
'--ignore-platform-reqs' => true,
'--lock' => true,
'--no-autoloader' => true,
'--no-plugins' => true,
'--no-scripts' => true,
'--working-dir' => $workingDirectory,
];

if ($input->hasParameterOption('--no-ansi')) {
$parameters = \array_merge($parameters, [
'--no-ansi' => true,
]);
}

return $application->run(
new Console\Input\ArrayInput([
'command' => 'update',
'--ignore-platform-reqs' => true,
'--lock' => true,
'--no-autoloader' => true,
'--no-plugins' => true,
'--no-scripts' => true,
'--working-dir' => $workingDirectory,
]),
new Console\Input\ArrayInput($parameters),
$output,
);
}
Expand Down

0 comments on commit 190f2d0

Please sign in to comment.