Skip to content

Commit

Permalink
Issue #25: Rename ReplaceConfigToken to ProcessConfigFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarco committed Jan 12, 2018
1 parent 6ff9301 commit 480e420
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions src/Commands/SetupCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace EC\OpenEuropa\TaskRunner\Commands;

use EC\OpenEuropa\TaskRunner\Tasks\ReplaceConfigTokens as ReplaceConfigTokens;
use EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile as ProcessConfigFile;
use Symfony\Component\Console\Input\InputOption;

/**
Expand All @@ -12,7 +12,7 @@
*/
class SetupCommands extends BaseCommands
{
use ReplaceConfigTokens\loadTasks;
use ProcessConfigFile\loadTasks;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -116,6 +116,6 @@ public function setupReplace(array $options = [
'destination' => InputOption::VALUE_REQUIRED,
])
{
return $this->taskReplaceConfigTokens($options['source'], $options['destination']);
return $this->taskProcessConfigFile($options['source'], $options['destination']);
}
}
4 changes: 2 additions & 2 deletions src/Tasks/CollectionFactory/CollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class CollectionFactory extends BaseTask implements BuilderAwareInterface
{
use LoadAllTasks;
use TaskRunner\Tasks\ReplaceConfigTokens\loadTasks;
use TaskRunner\Tasks\ProcessConfigFile\loadTasks;

/**
* @var array
Expand Down Expand Up @@ -106,7 +106,7 @@ protected function taskFactory(array $task)
return $this->taskFilesystemStack()->mirror($task['from'], $task['to']);

case "process":
return $this->taskReplaceConfigTokens($task['source'], $task['destination']);
return $this->taskProcessConfigFile($task['source'], $task['destination']);

default:
throw new TaskException($this, "Task '{$task['task']}' not supported.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EC\OpenEuropa\TaskRunner\Tasks\ReplaceConfigTokens;
namespace EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile;

use EC\OpenEuropa\TaskRunner\Traits\ConfigurationTokensTrait;
use Robo\Common\BuilderAwareTrait;
Expand All @@ -10,11 +10,11 @@
use Robo\Task\Filesystem\FilesystemStack;

/**
* Class ReplaceConfigTokens
* Class ProcessConfigFile
*
* @package EC\OpenEuropa\TaskRunner\Tasks\ReplaceConfigTokens
* @package EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile
*/
class ReplaceConfigTokens extends BaseTask implements BuilderAwareInterface
class ProcessConfigFile extends BaseTask implements BuilderAwareInterface
{
use BuilderAwareTrait;
use ConfigurationTokensTrait;
Expand Down Expand Up @@ -44,7 +44,7 @@ class ReplaceConfigTokens extends BaseTask implements BuilderAwareInterface
protected $replace;

/**
* ReplaceConfigTokens constructor.
* ProcessConfigFile constructor.
*
* @param string $source
* @param string $destination
Expand Down
22 changes: 22 additions & 0 deletions src/Tasks/ProcessConfigFile/loadTasks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile;

/**
* Trait loadTasks
*
* @package EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile
*/
trait loadTasks
{
/**
* @param $source
* @param $destination
*
* @return \EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile\ProcessConfigFile
*/
public function taskProcessConfigFile($source, $destination)
{
return $this->task(ProcessConfigFile::class, $source, $destination);
}
}
22 changes: 0 additions & 22 deletions src/Tasks/ReplaceConfigTokens/loadTasks.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

namespace EC\OpenEuropa\TaskRunner\Tests\Tasks;

use EC\OpenEuropa\TaskRunner\Tasks\ReplaceConfigTokens\ReplaceConfigTokens;
use EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile\ProcessConfigFile;
use EC\OpenEuropa\TaskRunner\Tests\AbstractTaskTest;
use Robo\Task\Simulator;
use Symfony\Component\Yaml\Yaml;

/**
* Class ReplaceConfigTokensTaskTest.
* Class ProcessConfigFileTest.
*
* @package EC\OpenEuropa\TaskRunner\Tests\Tasks
*/
class ReplaceConfigTokensTaskTest extends AbstractTaskTest
class ProcessConfigFileTest extends AbstractTaskTest
{
use \EC\OpenEuropa\TaskRunner\Tasks\ReplaceConfigTokens\loadTasks;
use \EC\OpenEuropa\TaskRunner\Tasks\ProcessConfigFile\loadTasks;

/**
* Test task.
Expand All @@ -29,7 +29,7 @@ public function testTask(array $data, array $expected)
$source = $this->getSandboxFilepath('source.yml');
$destination = $this->getSandboxFilepath('destination.yml');
file_put_contents($source, Yaml::dump($data));
$this->taskReplaceConfigTokens($source, $destination)->run();
$this->taskProcessConfigFile($source, $destination)->run();
$destinationData = Yaml::parse(file_get_contents($destination));
$this->assertEquals($expected, $destinationData);
}
Expand All @@ -42,7 +42,7 @@ public function testTask(array $data, array $expected)
*/
public function testExtractRawTokens($text, array $expected)
{
$task = new ReplaceConfigTokens(null, null);
$task = new ProcessConfigFile(null, null);
$actual = $this->invokeMethod($task, 'extractRawTokens', [$text]);
$this->assertEquals($expected, $actual);
}
Expand All @@ -52,14 +52,14 @@ public function testExtractRawTokens($text, array $expected)
*/
public function extractTokensDataProvider()
{
return $this->getFixtureContent('tasks/replace-config-tokens/extract.yml');
return $this->getFixtureContent('tasks/process-config-file/extract.yml');
}

/**
* @return array
*/
public function testTaskDataProvider()
{
return $this->getFixtureContent('tasks/replace-config-tokens/task.yml');
return $this->getFixtureContent('tasks/process-config-file/task.yml');
}
}

0 comments on commit 480e420

Please sign in to comment.