Skip to content

Commit

Permalink
Merge 5c06ca4 into f676455
Browse files Browse the repository at this point in the history
  • Loading branch information
prudloff-insite committed Jun 29, 2020
2 parents f676455 + 5c06ca4 commit 9f5bde4
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/tasks/Composer.md
Expand Up @@ -378,3 +378,37 @@ $this->taskComposerValidate()->run();
* `options(array $options, $separator = null)` Pass multiple options to executable. The associative array contains
* `optionList($option, $value = null, $separator = null)` Pass an option with multiple values to executable. Value can be a string or array.

## CheckPlatformReqs


Composer CheckPlatformReqs

``` php
<?php
// simple execution
$this->taskComposerCheckPlatformReqs()->run();
?>
```

* `preferDist($preferDist = null)` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `dev($dev = null)` adds `dev` option to composer
* `noDev()` adds `no-dev` option to composer
* `ansi($ansi = null)` adds `ansi` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `interaction($interaction = null)` * `param bool` $interaction
* `noInteraction()` adds `no-interaction` option to composer
* `optimizeAutoloader($optimize = null)` adds `optimize-autoloader` option to composer
* `ignorePlatformRequirements($ignore = null)` adds `ignore-platform-reqs` option to composer
* `disablePlugins($disable = null)` disable plugins
* `noScripts($disable = null)` skip scripts
* `workingDir($dir)` adds `--working-dir $dir` option to composer
* `buildCommand()` Copy class fields into command options as directed.
* `dir($dir)` Changes working directory of command
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null, $separator = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `options(array $options, $separator = null)` Pass multiple options to executable. The associative array contains
* `optionList($option, $value = null, $separator = null)` Pass an option with multiple values to executable. Value can be a string or array.

31 changes: 31 additions & 0 deletions src/Task/Composer/CheckPlatformReqs.php
@@ -0,0 +1,31 @@
<?php

namespace Robo\Task\Composer;

/**
* Composer Check Platform Requirements
*
* ``` php
* <?php
* // simple execution
* $this->taskComposerValidate()->run();
* ?>
* ```
*/
class CheckPlatformReqs extends Base
{
/**
* {@inheritdoc}
*/
protected $action = 'check-platform-reqs';

/**
* {@inheritdoc}
*/
public function run()
{
$command = $this->getCommand();
$this->printTaskInfo('Checking platform requirements: {command}', ['command' => $command]);
return $this->executeCommand($command);
}
}
10 changes: 10 additions & 0 deletions src/Task/Composer/loadTasks.php
Expand Up @@ -93,4 +93,14 @@ protected function taskComposerCreateProject($pathToComposer = null)
{
return $this->task(CreateProject::class, $pathToComposer);
}

/**
* @param null|string $pathToComposer
*
* @return \Robo\Task\Composer\CreateProject|\Robo\Collection\CollectionBuilder
*/
protected function taskCheckPlatformReqs($pathToComposer = null)
{
return $this->task(CheckPlatformReqs::class, $pathToComposer);
}
}
10 changes: 10 additions & 0 deletions tests/unit/Task/ComposerTest.php
Expand Up @@ -372,4 +372,14 @@ public function testComposerCreateProjectCommand()
->getCommand()
);
}

public function testComposerCheckPlatformReqsCommand()
{
$this->assertEquals(
$this->adjustQuotes("composer check-platform-reqs --no-interaction"),
(new \Robo\Task\Composer\CheckPlatformReqs('composer'))
->setConfig(new \Robo\Config())
->getCommand()
);
}
}

0 comments on commit 9f5bde4

Please sign in to comment.