Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPENEUROPA-1535: Fix various coding style inconsistencies. #92

Merged
merged 2 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "openeuropa/task-runner",
"description": "PHP task runner based on Robo, focused on extensibility.",
"keywords": ["Robo", "automation"],
"license": "EUPL-1.2",
"type": "library",
"minimum-stability": "dev",
Expand All @@ -11,7 +13,7 @@
"jakeasmith/http_build_url": "^1.0.1"
},
"require-dev": {
"openeuropa/code-review": "~1.0.0-alpha3",
"openeuropa/code-review": "~1.0@beta",
"phpunit/phpunit": "~5.5||~6.0"
},
"autoload": {
Expand All @@ -25,5 +27,9 @@
"My\\Custom\\": "./tests/custom/src/"
}
},
"extra": {
"enable-patching": true,
"composer-exit-on-patch-failure": true
},
"bin": ["bin/run"]
}
8 changes: 4 additions & 4 deletions src/Commands/AbstractDrupalCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ abstract class AbstractDrupalCommands extends AbstractCommands implements Filesy
public function getDrupal()
{
return $this->getConfig()->get('drupal.core') === 7 ?
new Drupal7Commands() :
new Drupal8Commands();
new Drupal7Commands() :
new Drupal8Commands();
}

/**
Expand Down Expand Up @@ -284,8 +284,8 @@ public function sitePreInstall()
* @return \Robo\Collection\CollectionBuilder
*/
public function drushSetup(array $options = [
'root' => InputOption::VALUE_REQUIRED,
'config-dir' => InputOption::VALUE_REQUIRED,
'root' => InputOption::VALUE_REQUIRED,
'config-dir' => InputOption::VALUE_REQUIRED,
])
{
$config = $this->getConfig();
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/ChangelogCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function getConfigurationFile()
* @return \Robo\Task\Docker\Run
*/
public function generateChangelog(array $options = [
'token' => InputOption::VALUE_REQUIRED,
'tag' => InputOption::VALUE_OPTIONAL,
'token' => InputOption::VALUE_REQUIRED,
'tag' => InputOption::VALUE_OPTIONAL,
])
{
$projectName = $this->getComposer()->getName();
Expand All @@ -52,10 +52,10 @@ public function generateChangelog(array $options = [
}

$task = $this->taskDockerRun('muccg/github-changelog-generator')
->option('rm')
->rawArg('-v $(pwd):$(pwd)')
->rawArg('-w $(pwd)')
->exec($exec);
->option('rm')
->rawArg('-v $(pwd):$(pwd)')
->rawArg('-w $(pwd)')
->exec($exec);

return $task;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/ReleaseCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function setRuntimeConfig(ConsoleCommandEvent $event)
* @aliases release:ca,rca
*/
public function createRelease(array $options = [
'tag' => InputOption::VALUE_OPTIONAL,
'keep' => false,
'tag' => InputOption::VALUE_OPTIONAL,
'keep' => false,
])
{
$name = $this->composer->getProject();
Expand All @@ -96,12 +96,12 @@ public function createRelease(array $options = [

$tasks = [
// Make sure we do not have a release directory yet.
$this->taskFilesystemStack()->remove([$archive, $name]),
$this->taskFilesystemStack()->remove([$archive, $name]),

// Get non-modified code using git archive.
$this->taskGitStack()->exec(["archive", "HEAD", "-o $name.zip"]),
$this->taskExtract("$name.zip")->to("$name"),
$this->taskFilesystemStack()->remove("$name.zip"),
$this->taskGitStack()->exec(["archive", "HEAD", "-o $name.zip"]),
$this->taskExtract("$name.zip")->to("$name"),
$this->taskFilesystemStack()->remove("$name.zip"),
];

// Append release tasks defined in runner.yml.dist.
Expand Down
16 changes: 8 additions & 8 deletions src/Contract/RepositoryAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
interface RepositoryAwareInterface
{

/**
* @return Repository
*/
/**
* @return Repository
*/
public function getRepository();

/**
* @param \Gitonomy\Git\Repository $repository
*
* @return $this
*/
/**
* @param \Gitonomy\Git\Repository $repository
*
* @return $this
*/
public function setRepository(Repository $repository);
}
12 changes: 6 additions & 6 deletions src/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ private function createContainer(InputInterface $input, OutputInterface $output,

// Add service inflectors.
$container->inflector(ComposerAwareInterface::class)
->invokeMethod('setComposer', ['task_runner.composer']);
->invokeMethod('setComposer', ['task_runner.composer']);
$container->inflector(TimeAwareInterface::class)
->invokeMethod('setTime', ['task_runner.time']);
->invokeMethod('setTime', ['task_runner.time']);
$container->inflector(FilesystemAwareInterface::class)
->invokeMethod('setFilesystem', ['filesystem']);
->invokeMethod('setFilesystem', ['filesystem']);
$container->inflector(RepositoryAwareInterface::class)
->invokeMethod('setRepository', ['repository']);
->invokeMethod('setRepository', ['repository']);

return $container;
}
Expand All @@ -190,8 +190,8 @@ private function createApplication()
{
$application = new Application(self::APPLICATION_NAME, 'UNKNOWN');
$application
->getDefinition()
->addOption(new InputOption('--working-dir', null, InputOption::VALUE_REQUIRED, 'Working directory, defaults to current working directory.', $this->workingDir));
->getDefinition()
->addOption(new InputOption('--working-dir', null, InputOption::VALUE_REQUIRED, 'Working directory, defaults to current working directory.', $this->workingDir));

return $application;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Tasks/CollectionFactory/CollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ protected function taskFactory($task)

// Map dynamic task type to actual task callback.
$map = [
'append' => "taskAppendConfiguration",
'prepend' => "taskPrependConfiguration",
'write' => "taskWriteConfiguration",
'append' => "taskAppendConfiguration",
'prepend' => "taskPrependConfiguration",
'write' => "taskWriteConfiguration",
];

if (!isset($map[$task['type']])) {
Expand All @@ -177,7 +177,7 @@ protected function taskFactory($task)

// Add selected process task and return collection.
$tasks[] = $this->{$method}($task['destination'], $this->getConfig())
->setConfigKey($task['config']);
->setConfigKey($task['config']);

return $this->collectionBuilder()->addTaskList($tasks);

Expand Down
30 changes: 15 additions & 15 deletions tests/Commands/ReleaseCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,23 @@ protected function getRepositoryMock(array $repository)
}

$mock = $this->getMockBuilder(Repository::class)
->disableOriginalConstructor()
->setMethods([
'getHead',
'getReferences',
'resolveTags',
'getBranches',
])
->getMock();
->disableOriginalConstructor()
->setMethods([
'getHead',
'getReferences',
'resolveTags',
'getBranches',
])
->getMock();

$head = $this->getMockBuilder(Commit::class)
->disableOriginalConstructor()
->setMethods([
'getCommit',
'getRevision',
'getHash',
])
->getMock();
->disableOriginalConstructor()
->setMethods([
'getCommit',
'getRevision',
'getHash',
])
->getMock();
$head->expects($this->any())->method('getCommit')->willReturnSelf();
$head->expects($this->any())->method('getHash')->willReturn($repository['hash']);
$head->expects($this->any())->method('getRevision')->willReturn($repository['revision']);
Expand Down
20 changes: 10 additions & 10 deletions tests/CommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ public function testCustomCommands()
$runner->run();

$expected = [
"custom:command-four",
"custom:command-one",
"custom:command-three",
"custom:command-two",
"custom:command-four",
"custom:command-one",
"custom:command-three",
"custom:command-two",
];

$text = $output->fetch();
Expand Down Expand Up @@ -195,8 +195,8 @@ function $fct() {}
EOF;

$config_override_filename = isset($config['drupal']['site']['settings_override_file']) ?
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';

// Add the dummy PHP code to the config override file.
file_put_contents(
Expand Down Expand Up @@ -246,8 +246,8 @@ function $fct() {}
EOF;

$config_override_filename = isset($config['drupal']['site']['settings_override_file']) ?
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';

// Add the dummy PHP code to the config override file.
file_put_contents(
Expand Down Expand Up @@ -301,8 +301,8 @@ function $fct() {}
EOF;

$config_override_filename = isset($config['drupal']['site']['settings_override_file']) ?
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';
$config['drupal']['site']['settings_override_file'] :
'settings.override.php';

// Add the dummy PHP code to the config override file.
file_put_contents(
Expand Down
10 changes: 5 additions & 5 deletions tests/Tasks/CollectionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public function testProcessPhpTask($type, $override, $destinationExists, $source

$tasks = [];
$tasks[] = [
'task' => 'process-php',
'config' => 'drupal.drush',
'type' => $type,
'source' => $sourceFile,
'destination' => $destinationFile,
'task' => 'process-php',
'config' => 'drupal.drush',
'type' => $type,
'source' => $sourceFile,
'destination' => $destinationFile,
];

// Make sure we test default override option by not setting it if null.
Expand Down